Skip to content
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

Way to style or mark an API method as deprecated #173

Closed
aleksihakli opened this issue Jul 30, 2018 · 2 comments
Closed

Way to style or mark an API method as deprecated #173

aleksihakli opened this issue Jul 30, 2018 · 2 comments

Comments

@aleksihakli
Copy link

Hey, and thanks for the awesome documentation generator! Is there currently a way for marking an API method as deprecated by e.g. overlining it in the UI? I think the custom .deprecated HTML class does that, but I didn't find a method for setting HTML classes for the UI elements generated from DRF viewsets.

@axnsan12
Copy link
Owner

axnsan12 commented Aug 1, 2018

You should set the deprecated field on the Operation object: https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#operation-object

You can achieve this with a custom SwaggerAutoSchema subclass. Ideally it could also be set using swagger_auto_schema, however that is not yet possible. See also #149.

@axnsan12 axnsan12 closed this as completed Aug 1, 2018
@aleksihakli
Copy link
Author

Thanks, I'll try overriding the schema. I think the custom decorator would be really nice.

axnsan12 pushed a commit that referenced this issue Sep 9, 2018
Add missing `operation_summary` and `deprecated` to `swagger_auto_schema` decorator data. The previous PR missed adding these to extra overrides.

- Added tests
- Updated reference.yaml

Refs #149, #173.
Closes #194, #198.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants