Skip to content

WIP: OAS 3.0 additional schema fields #6656

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

Closed

Conversation

n2ygk
Copy link
Contributor

@n2ygk n2ygk commented May 8, 2019

Description

Adds ability to provide (and merge) lots of OAS schema fields.

@carltongibson please take a look and let me know if this is headed in the right direction.

Here's an example usage:

class CourseBaseViewSet(AuthnAuthzMixIn, ModelViewSet):
    #: fill in some of the openapi schema
    openapi_schema = {
        'info': {
            'version': __version__,
            'title': __title__,
            'description': __copyright__ + '\ndemonstration of django-rest-framework-jsonapi',
            'contact': {
                'name': __author__
            },
            'license': {
                'name': __license__
            }
        },
        'servers': [
            {'url': 'http://localhost:8000/v1'}
        ]
    }
    schema = JSONAPIAutoSchema(openapi_schema=openapi_schema)

Still working on jsonapi-flavored OAS schema generation that uses this.

@carltongibson
Copy link
Collaborator

Hey @n2ygk. Thanks for this. Due to life, I didn't get a chance at all to look at it this week. I'll take it on on Monday.

@carltongibson carltongibson self-requested a review May 10, 2019 14:48
@n2ygk
Copy link
Contributor Author

n2ygk commented May 10, 2019 via email

@@ -14,6 +15,10 @@


class SchemaGenerator(BaseSchemaGenerator):
def __init__(self, **kwargs):
super(SchemaGenerator, self).__init__(**kwargs)
Copy link
Member

Choose a reason for hiding this comment

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

as 3.10 is python 3+ only so I guess super().init() without explicit calling, SchemaGenerator should be alright.

@carltongibson carltongibson added this to the 3.10 Release milestone May 13, 2019
@carltongibson carltongibson force-pushed the openapi-schema-generation branch 2 times, most recently from b8bd082 to b4ec102 Compare May 13, 2019 13:50
Co-authored-by: Lucidiot <[email protected]>
Co-authored-by: dongfangtianyu <[email protected]>
@n2ygk n2ygk force-pushed the openapi_add_fields branch from 90617b1 to 37f210a Compare May 13, 2019 15:02
@n2ygk
Copy link
Contributor Author

n2ygk commented May 13, 2019

Closing this and will resubmit a new PR against master.

@n2ygk n2ygk closed this May 13, 2019
@n2ygk
Copy link
Contributor Author

n2ygk commented May 13, 2019

See #6670

@n2ygk
Copy link
Contributor Author

n2ygk commented May 14, 2019

See #6674

@rpkilby rpkilby removed this from the 3.10 Release milestone May 17, 2019
@n2ygk n2ygk deleted the openapi_add_fields branch June 9, 2019 12:51
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.

4 participants