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

Adds support for schema inheritance to OAPI3 #257

Closed alg closed 1 year ago

alg commented 1 year ago

This change was done to the OAPI2, and can be ported to the version 3.

class Employee:
    name = doc.String(required=True)

class FullEmployee(Employee):
    phone = doc.String(required=True)

Builds schema with both fields for FullEmployee model. Without this fix, it's only phone.

ahopkins commented 1 year ago

Thanks, but we're really not supporting this package anymore. The OpenAPI 3 supported lib is a part of sanic-ext. https://sanic.dev/en/plugins/sanic-ext/openapi/basic.html

There's really no one that can say whether this is an acceptable change or not and what breaking changes it may or may not cause.

I'd advise you to use the new lib. It is based off this and should be an easy upgrade. If it's a problem there then I'd be happy to help you address in that lib.

alg commented 1 year ago

@ahopkins thanks for coming back. We attempted to migrate and faced some issues, so decided to stay. I'll keep the patch in my fork. We also monkey-patched the lib to get the inheritance support as copying tens of fiends over is no fun. )

I'll give sanic-ext another look a bit later. Cheers.