sanic-org / sanic-openapi

Easily document your Sanic API with a UI
https://sanic-openapi.readthedocs.io/
MIT License
505 stars 107 forks source link

[Feature Request] Custom Ordering of Endpoints and Authorization #245

Closed amit-d-bahir closed 2 years ago

amit-d-bahir commented 3 years ago

Is your feature request related to a problem? Please describe your use case.

Describe the solution you'd like For ordering, if I can give priority as topmost then it will always be on the top. For authorization, adding a decorator that excludes_authorization.

ahopkins commented 3 years ago

You can control this with tags. They should appear in the order in which the tags are created.

amit-d-bahir commented 3 years ago

I am able to group the endpoints using tags. But the order in which those endpoints occur under those tags on the UI is random every time I restart the server. Is there any way I can have a particular tag always on top?

ahopkins commented 3 years ago

You can customize with the Swagger config

app.config.SWAGGER_UI_CONFIGURATION = {
    "operationsSorter": "method",
}

Sounds like for your need, you might need to pass a function, which can only be done in the JS. I am not sure there is a good way to do that just now.

ahopkins commented 3 years ago

To be :100: honest, it is not likely to be a feature that will be added to this package. I am actively working on sanic-ext Read more. Having more control over the static assets will be something available there, and should be a near drop-in replacement for sanic-openapi (at least for OAS3, we are dropping the @doc and OAS2).

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If this is incorrect, please respond with an update. Thank you for your contributions.