-
Notifications
You must be signed in to change notification settings - Fork 265
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
Add support to Specification Extensions #165
Comments
hey @jairhenrique, can you give an example where this would be beneficial? extensions are very generic by nature and could be placed pretty much anywhere. |
Hi @tfranzel I want do use this extra data to automate and document some steps on my deployment/environment. This feature will be useful to dev and ops team! |
i absolutely see the usefulness of this. the problem is that those extensions can in theory be used anywhere in the schema and we have no mechanism to freely place extensions. how would we try to inject these extensions? |
@tfranzel I need to take a better look on the source code. I don't know how to make it generic. Does it make sense to have an object to represent it and some logic in the preprocess hooks? @extend_schema(
specification_extensions=OpenApiSpecificationExtensions(
data={
'x-foo': 'bar',
'x-bar': {'a': 'b'},
'x-node':1
}
)
) SPECTACULAR_DEFAULTS = {
"specification_extensions": OpenApiSpecificationExtensions(
data={
'x-foo': 'bar',
'x-bar': {'a': 'b'},
'x-node':1
}
)
} |
We can maybe take the extensions documentation published by Redoc as a starting point and then increase support as required. Some extensions like What do you think @tfranzel ?? |
generally i find the idea interesting. but i'm still hesitant on how to cleanly integrate this. as far as i can see those extensions can pop up everywhere and thus code would need to change in a lot of places. a lot of those redoc extensions are already part of 3.0.3 and are backported for older versions. at least that is what i understand. sure, extensions like for small additions there are always postprocessing hooks as a alternative. before really considering this as a core feature, i would like to see some really useful features we are missing out on. @jairhenrique fyi, we included the examples feature a couple of days ago. some of your points might have also been addressed by OpenApiExample. let me know what you think. |
@sdabhi23 this would be ideal, I realize adding all extensions does not make sense everywhere. But a few key ones in the SPECTACULAR_DEFAULTS defaults could be really useful. Like x-logo |
so the |
as discussed this gives an option for the info object. tags are already covered. due to the generic nature of extensions and the multitude of ways this could be employed, i hardly doubt we can go much further here without doing an incomplete and inconsistent feature. i'll close the issue for now. if someone can come up with a really good concept here, we can most certainly revisit this. |
How to add logo to drf spectacular redoc 🚀🚀🚀🚀
🚀🚀 Thanks ! 🚀🚀 |
https://swagger.io/specification/#specification-extensions
The text was updated successfully, but these errors were encountered: