Skip to content

Ignore derivations of BrowsableAPIRenderer in OpenAPI schema #7497

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

Merged
merged 3 commits into from
Oct 12, 2020

Conversation

akx
Copy link
Contributor

@akx akx commented Aug 26, 2020

Description

If the BrowsableAPIRenderer has been subclassed, it wouldn't be correctly ignored by the OpenAPI Schema generator.

Fixes #7477

@carltongibson
Copy link
Collaborator

Duplicate of #7477 no?

@akx
Copy link
Contributor Author

akx commented Aug 26, 2020

@carltongibson Well, sure, this PR implements a fix for #7477.

@carltongibson
Copy link
Collaborator

Doh, yes super. I thought that was a PR looking earlier.

Did you see the comment there about the test?

@kevin-brown
Copy link
Member

Just to quote the comment there, since this PR should have added tests to ensure we don't have a regression in the future.

From #7477 (comment)

There's a test_renderer_mapping that could be fleshed out. I'd suggest ensure that neither the base class, nor any subclasses are included. 👍

@akx akx force-pushed the openapi-ignore-browsable-subclasses branch from 2289b3b to 456e71a Compare October 12, 2020 14:08
@akx
Copy link
Contributor Author

akx commented Oct 12, 2020

@carltongibson Sorry for the delay. Rebased and fleshed out the test :)

Copy link
Collaborator

@carltongibson carltongibson left a comment

Choose a reason for hiding this comment

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

Super. Thanks @akx. Looks good to me. 👍

@carltongibson
Copy link
Collaborator

Of course isort failed. Let's see if 5a9c6c5 fixes it.

@carltongibson carltongibson merged commit 0bdd537 into encode:master Oct 12, 2020
@tomchristie tomchristie mentioned this pull request Oct 13, 2020
@tomchristie tomchristie removed this from the 3.13 Release milestone Mar 25, 2021
sigvef pushed a commit to sigvef/django-rest-framework that referenced this pull request Dec 3, 2022
…7497)

* Ignore derivations of BrowsableAPIRenderer in OpenAPI schema
* Improve test_renderer_mapping test

Co-authored-by: Carlton Gibson <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Subclasses of BrowsableAPIRenderer should not be output in schema
4 participants