marshmallow-code / marshmallow-code/apispec-webframeworks
RFC: enforce method order for one endpoint in the spec
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 33
- Forks
- 24
- Avg merge
- 5h 38m
- Merged PRs (30d)
- 4
Description
**Issue by [lafrech](https://github.com/lafrech)**
_Wednesday Apr 04, 2018 at 13:39 GMT_
_Originally opened as https://github.com/marshmallow-code/apispec/issues/193_
----
_Although json objects are not ordered, some tools respect the order in the OpanAPI json file to display the spec. Therefore, it makes sense to respect the order desired by the user when writing the spec file. Several PRs are based on this assumption (#86, #87, #189)._
It could be nice to enforce the order of the methods for each endpoint. For instance, always present the methods in this order:
HTTP_METHODS = ['OPTIONS', 'HEAD', 'GET', 'POST', 'PUT', 'PATCH', 'DELETE', 'TRACE']
The order list being a module variable, it could be mutated by the user if another order is required.
This feature requires modifications in flask, tornado, and perhaps bottle extensions. More details in https://github.com/marshmallow-code/apispec/pull/189.
Edit: I'd remove `'TRACE'` from the list as it is not in [`VALID_METHODS`](https://github.com/marshmallow-code/apispec/blob/ea55ad0463b7fe6039d5e6507254682fd3ffdbb3/apispec/core.py#L13).
Edit again: OpenAPI 3 contains `TRACE` (https://github.com/marshmallow-code/apispec/issues/165#issuecomment-388753808).
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with apispec/core.py and the Flask, Tornado, and Bottle extensions mentioned in the issue; inspect VALID_METHODS and the ordering behavior discussed in PR #189. Determine how each plugin emits endpoint methods, then verify with the relevant extension tests that the requested method order is preserved.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- flask, openapi, python
- Domain
- api, backend-api-design, tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100