-
Notifications
You must be signed in to change notification settings - Fork 508
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
Multiple Routes Swagger Documentation #658
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
multiple routes params override test
2 similar comments
j5awry
approved these changes
Jul 1, 2019
even it's late, but a big thank to you. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation
See #288 for initial issue.
Using the
doc
parameter ofApi.route()
decorator applies documentation to theResource
as a whole. This prevents documentation being added on a per-route basis (for example adding an additional description to a route, or marking one route as deprecated) as thedoc
is applied to all routes.Furthermore, each route uses the same Swagger
operationId
, causing both routes to be expanded at the same time when selecting one in the Swagger UI (the elements are selected using an HTMLid
which is set to theoperationId
.Changes
doc
parameterApi.route()
will apply the documentation to that route onlydoc
parameter are given uniqueoperationId
s (combining the originaloperationId
with the URLs provided)Resource
(i.e. if applied using@api.doc
, unless explicitly overridden with thedoc
parameterExamples
Providing a
description
to a single route:Expanding the first route only (note the
description
):Expanding the second route only (note lack of
description
):Inheriting/overriding from the
Resource
Expanding the first route only (note
id
parameter from@api.doc()
but overriddendescription
)Expanding the second route only (note
id
parameter anddescription
inherited from@api.doc()
decorator):Various combinations of the above can be used with of the available documentation parameters (
description
,id
,params
,deprecated
etc).