marshmallow-code/apispec-webframeworks

RFC: enforce method order for one endpoint in the spec

开放

#15 创建于 2018年11月3日

 (1 条评论) (0 个反应) (0 位负责人)Python (24 个派生)github user discovery
enhancementfeedback welcomehelp wanted

仓库指标

星标
 (33 个星标)
PR 合并指标
 (平均合并 30分钟) (30 天内合并 3 个 PR)

描述

Issue by 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.

Edit again: OpenAPI 3 contains TRACE (https://github.com/marshmallow-code/apispec/issues/165#issuecomment-388753808).

贡献者指南