-
-
Notifications
You must be signed in to change notification settings - Fork 528
Missing extension to schema property #622
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
Comments
This is due to the fact that MonetaryAmount is a complex object wich is by default resolved using $ref. If an application wants to enable the springdoc-openapi support, it declares: SpringDocUtils.getConfig().replaceWithClass(MonetaryAmount.class, org.springdoc.core.converters.MonetaryAmount.class); In order to enable the extension for a complex object, it shouldn't be resolved as $ref; If you declare the following, it should work. SpringDocUtils.getConfig().replaceWithSchema(MonetaryAmount.class, new ObjectSchema()
.addProperties("amount", new NumberSchema()).example(99.96)
.addProperties("currency", new StringSchema().example("USD"))); PS: Please don't open many issues on the same topic. In this case are related to add the MonetaryAmount on springdoc. #621, #622, #617, #606. |
Hi @bnasslahsen One doubt: R |
The rendering of Complex properties is not done by springdoc-openapi, but using swagger-core.
I don't see how you can get extension on complex properties with the current swagger-core implementation. |
@bnasslahsen |
I was going to release v1.3.5. If its a minor change, i can wait. |
@bnasslahsen |
@bnasslahsen |
The springdoc-openapi relies on swagger-core. Option B, is the better choice. |
@raghuraman1 |
@bnasslahsen , |
@bnasslahsen |
FYI the first solution is outdated (also in the FAQ https://springdoc.org/faq.html#how-can-i-use-enable-springdoc-openapi-monetaryamount-support-), the class that should be used is Using sprindoc 1.5.6 here, still get the error without manually setting the converter. I believe this was mentioned to be an issue with swagger-core, is there any update on this? |
Doc is now updated. Note that you can propose PR for it which is welcome in Open Source projects. |
Lovely, cheers for fixing! :) |
Uh oh!
There was an error while loading. Please reload this page.
Hi @bnasslahsen ,
Please see https://github.com/teq-niq/sample/tree/extending3
In the person schema for worth field am expecting a extension x-Currency with value USD.
I am trying to show using swagger extensions validation constraints that swagger or springdoc might not be showing. This includes even custom constraints.
In springdoc-openapi-webmvc-core\src\main\java\org\springdoc\webmvc\api\OpenApiResource.java I debugged this method - openapiJson()
I can see the extension with correct value in this object
OpenAPI openAPI = this.getOpenApi();
But the extension is missing in the api-docs json. The other extensions are all appearing properly.

Attaching the json txt:
json.txt
Raghu
The text was updated successfully, but these errors were encountered: