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

Fix swagger API docs generation #1366

Merged
merged 6 commits into from
Dec 15, 2023
Merged

Fix swagger API docs generation #1366

merged 6 commits into from
Dec 15, 2023

Conversation

keshav-space
Copy link
Member

- Use `extend_schema` to override the request body, which was not being properly discovered.

- drf-spectacular relies on `get_serializer_class()` and `get_serializer()`, and it works well for view functions that purely deal with ModelSerializer. For anything else, it gets a bit murky, and it is advised to provide proper overrides in the `extend_schema` decorator.

- Override erroneous pagination and filter backend caused due to response containing multiple serializer object https://drf-spectacular.readthedocs.io/en/latest/faq.html#my-action-is-erroneously-paginated-or-has-filter-parameters-that-i-do-not-want

Signed-off-by: Keshav Priyadarshi <[email protected]>
@keshav-space keshav-space added bug API documentation Everything about documentation labels Dec 13, 2023
vulnerabilities/api.py Show resolved Hide resolved
Copy link
Contributor

@TG1999 TG1999 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Copy link
Contributor

@TG1999 TG1999 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@keshav-space thanks! can you also check for lookup and bulk_lookup endpoint as well

@keshav-space keshav-space changed the title Fix swagger API doc for api/packages/bulk_search/ Fix swagger API docs generation Dec 14, 2023
Copy link
Contributor

@TG1999 TG1999 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@TG1999 TG1999 merged commit e9c280d into main Dec 15, 2023
11 checks passed
@keshav-space keshav-space deleted the fix-api-bulk-search-doc branch December 15, 2023 08:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API bug documentation Everything about documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants