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
@ExampleProperty/value is getting ignored #3037
Comments
+1 |
2 similar comments
+1 |
+1 |
@napolev thank you for a detailed issue. I'll look into this issue. Can you see what the json looks like for the endpoint? Im curious if this is an issue with swagger-ui |
+1 |
@dilipkrish seems like a UI issue since the examples actually get to the FE but are never displayed. |
+1 |
Hi @dilipkrish, any update on this? Thanks! |
+1 |
@dilipkrish Any update on this issue? The examples are not working in 2.9.2. For us examples are a must for documentation. Please help! |
is this project discontinued maybe? |
So examples will never work in springfox -- I wonder how other organizations used swagger with examples in 2.0. Any pointers would really help. Thanks! |
Like @Maegner said the x-examples are loaded properly however they are not displayed in the UI. |
Apparently I did not have issue using |
I discovered that springfox produces x-examples in the json description file which is not recognized by spring-ui.The right format that spring ui correctly renders is having the example as part of the schema block of the field.Also called example not x-examples
all libraries versions are 2.9.2. |
Has anybody tried this with 3.0.0.-SNAPSHOT? I have the same issue with 2.9.2 |
Hi! @mdfass I already tried with 3.0.0-SNAPSHOT and still the same issue with 2.9.2. No change about it! |
yes,I've tried with 3.0.0-SNAPSHOT and it's still the same.Can you try to do what I've suggested to see if it works for you? |
Hi! @nikosvaggalis I have tried what you suggested before about changing the
For this purpose I took the first example in this issue provided by @napolev, first of all I changed the Do you have any idea on how can I get that result by using Just in case here you have the repo I created for this purpose: https://github.com/indicasta/springfox-swagger2-issue Thanks! |
thank you @indicasta for your clear feedback. I think we need to know what Springfox annotations to use on top of the controller method in order to let Springfox to do the proper conversion from Java to Swagger syntax (left panel on the image above). In my opinion this is a very common use case. Hopefully @dilipkrish can provide some light on this. |
Bingo! Finally on this commit I was able to find the way to make napolev/springfox-swagger2-issue@7e2591d Here you have a screenshot of it: Thank you guys for all your help including @indicasta. |
I tried with 3.0.0-SNAPSHOT and issue still persists |
I confirm it works in editor.swagger.io if you manual add example section but springfox simply ignores it if it finds a reference model and tries to infer the schema from model. However this approach doesn't work if your model going to have dynamic property names e.g. model has <string, object> response property. |
This has be fixed via #2767 |
What version of the library are you using?
What kind of issue is this?
Example Repository
https://github.com/napolev/springfox-swagger2-issue
How to recreate the issue
Description of the issue
On the repository pointed above there is a very simple project which contains the following file:
/src/main/java/com/example/demo/car/CarController.java
The issue is that the @ExampleProperty / value is getting ignored as you can see on the image below:
Other than that, everything works fine. For example, for the following payload the response is correct:
The text was updated successfully, but these errors were encountered: