Maintain order in which methods are added to endpoint#189
Merged
sloria merged 2 commits intomarshmallow-code:devfrom Apr 4, 2018
Nobatek:dev_endpoint_method_order
Merged
Maintain order in which methods are added to endpoint#189sloria merged 2 commits intomarshmallow-code:devfrom Nobatek:dev_endpoint_method_order
sloria merged 2 commits intomarshmallow-code:devfrom
Nobatek:dev_endpoint_method_order
Conversation
Member
Author
|
Rebasing this on #190 assuming it would be merged as is. If not, I'll rebase again. This change is useful to me because I'm enforcing the order of the methods for each endpoint in the spec: I find it nice to have a consistent method order. It works because I'm iterating on the methods in my lib, not in apispec. For people using HTTP_METHODS = ['OPTIONS', 'HEAD', 'GET', 'POST', 'PUT', 'PATCH', 'DELETE', 'TRACE']
def path_from_view(spec, view, **kwargs):
[...]
operations = OrderedDict()
for method in HTTP_METHODS:
if method in view.methods and method in rule.methods:
[...]Likewise for tornado and the others. This means hardcoding the method order. The user could mutate the global method list to control the order, though. I think this can be done in another PR without holding this one. |
Member
Member
Author
|
Great. I just rebased and opened #193. |
This file contains hidden or 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
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.
Similar to #86 and #87.