springfox: @ExampleProperty/value is getting ignored
What version of the library are you using?
2.9.2
What kind of issue is this?
Bug
Example Repository
https://github.com/napolev/springfox-swagger2-issue
How to recreate the issue
$ git clone https://github.com/napolev/springfox-swagger2-issue
$ cd springfox-swagger2-issue
$ gradle bootRun
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:
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 13
- Comments: 24 (2 by maintainers)
@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!
Bingo! Finally on this commit I was able to find the way to make
Sprinfox Swagger
to auto populate the values on theSwagger UI
:https://github.com/napolev/springfox-swagger2-issue/commit/7e2591d07fc5d8e83282f01bd7e8ce5e2475c761
Here you have a screenshot of it:
Thank you guys for all your help including @indicasta.
Hi! @nikosvaggalis I have tried what you suggested before about changing the
JSON
file produced bySpringfox
, replacing the “x-examples” by:For this purpose I took the first example in this issue provided by @napolev, first of all I changed the
Springfox
version from2.9.2
to3.0.0-SNAPSHOT
and reduced theJSON
file obtained with this last version, then I converted theJSON
file toYML
using the swagger editor. You can find the result in https://github.com/indicasta/springfox-swagger2-issue/blob/master/api-docs-reduced.yml. Finally with this reduction I got the expected result shown in the image below.Do you have any idea on how can I get that result by using
Springfox
automatically?Just in case here you have the repo I created for this purpose:
https://github.com/indicasta/springfox-swagger2-issue
Thanks!