New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow setting example paths and queries for DocService #2546
Conversation
Motivation: Currently, a user cannot set example paths and queries. line#2195 The endpoint path or queries are only set automatically when sharing a URL that contains `endpoint_path` or `queries` as params. Modifications: - Add `examplePaths` to `DocService` and `DocServiceBuilder` - Add `exampleQueries` to `DocService` and `DocServiceBuilder` - Show `examplePath` if the `endpoint_path` is null and the `examplePath` is not null - Show `exampleQuery` if the `queries` is null and the `exampleQuery` is not null - Make `ENDPOINT PATH` input visible with readonlyif path type is exact Result: You can now set an example path and queries for `DocService`
/cc @julnamoo |
core/src/main/java/com/linecorp/armeria/server/docs/DocService.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💯 Thanks, @ikhoon!
Codecov Report
@@ Coverage Diff @@
## master #2546 +/- ##
========================================
Coverage ? 73.6%
Complexity ? 10947
========================================
Files ? 956
Lines ? 41917
Branches ? 5248
========================================
Hits ? 30851
Misses ? 8370
Partials ? 2696
Continue to review full report at Codecov.
|
core/src/main/java/com/linecorp/armeria/server/docs/DocServiceBuilder.java
Outdated
Show resolved
Hide resolved
core/src/main/java/com/linecorp/armeria/server/docs/DocServiceBuilder.java
Outdated
Show resolved
Hide resolved
this.examplePaths = ImmutableList.copyOf(requireNonNull(examplePaths, "examplePaths")); | ||
this.exampleQueries = ImmutableList.copyOf(requireNonNull(exampleQueries, "exampleQueries")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about validating all paths and query strings, using PathAndQuery
and QueryParams.fromQueryString()
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not addressed yet.
/** | ||
* Adds the specified example query strings for the method with the specified service and method name. | ||
*/ | ||
public DocServiceBuilder exampleQueries(Class<?> serviceType, String methodName, Iterable<String> queries) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
queries
-> queryStrings
core/src/main/java/com/linecorp/armeria/server/docs/DocServiceBuilder.java
Outdated
Show resolved
Hide resolved
core/src/main/java/com/linecorp/armeria/server/docs/DocServiceBuilder.java
Outdated
Show resolved
Hide resolved
core/src/main/java/com/linecorp/armeria/server/docs/DocServiceBuilder.java
Outdated
Show resolved
Hide resolved
core/src/main/java/com/linecorp/armeria/server/docs/DocServiceBuilder.java
Outdated
Show resolved
Hide resolved
core/src/main/java/com/linecorp/armeria/server/docs/DocServiceBuilder.java
Outdated
Show resolved
Hide resolved
this.examplePaths = ImmutableList.copyOf(requireNonNull(examplePaths, "examplePaths")); | ||
this.exampleQueries = ImmutableList.copyOf(requireNonNull(exampleQueries, "exampleQueries")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not addressed yet.
core/src/main/java/com/linecorp/armeria/server/docs/MethodInfo.java
Outdated
Show resolved
Hide resolved
core/src/main/java/com/linecorp/armeria/server/docs/MethodInfo.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Thanks for your patience!
Motivation: Currently, a user cannot set example paths and queries. line#2195 The endpoint path or queries are only set automatically when opening a URL that contains `endpoint_path` or `queries` as params. Modifications: - Add `examplePaths` to `DocService` and `DocServiceBuilder` - Add `exampleQueries` to `DocService` and `DocServiceBuilder` - Show `examplePath` if the `endpoint_path` is null and the `examplePath` is not null - Show `exampleQuery` if the `queries` is null and the `exampleQuery` is not null - Make `ENDPOINT PATH` input visible with read-only if a path is exact type Result: You can now set an example path and queries for `DocService` Fixes line#2195
Motivation:
Currently, a user cannot set example paths and queries. #2195
The endpoint path or queries are only set automatically when
opening a URL that contains
endpoint_path
orqueries
as params.Modifications:
examplePaths
toDocService
andDocServiceBuilder
exampleQueries
toDocService
andDocServiceBuilder
examplePath
if theendpoint_path
is null and theexamplePath
is not nullexampleQuery
if thequeries
is null and theexampleQuery
is not nullENDPOINT PATH
input visible with read-only if a path is exact typeResult:
You can now set an example path and queries for
DocService
Fixes #2195