Extensions in ApiModelProperty
See original GitHub issueHi,
I am using springfox v2.9.2 and I have been able to use extensions on @ApiOperation
annotations, but I can’t use them on @ApiModelProperty
annotations. Is there something I am missing in this as I can see that the Extensions items are in the Swagger code for ApiModelProperty but they don’t get carried across to the Swagger documentation like they do when they are in the ApiOperation annotation. Below is what I am adding as the extensions.
@ApiModelProperty(name = "preference",
value = "Specifies the preference.\n" +
"Default: fastest.", extensions = {
@Extension(name = "test", properties = {
@ExtensionProperty(name="test-prop", value="val")
})
})
Thanks
Issue Analytics
- State:
- Created 5 years ago
- Reactions:4
- Comments:10 (2 by maintainers)
Top Results From Across the Web
ApiModelProperty (swagger-annotations 1.5.19 API) - javadoc.io
A sample value for the property. Extension[], extensions. boolean, hidden. Allows a model property to be hidden in ...
Read more >Extension (swagger-annotations 1.5.0 API)
The extension properties. Returns: the actual extension properties; See Also: ExtensionProperty. name. public abstract String name.
Read more >io.swagger.annotations.Extension Java Examples
This page shows Java code examples of io.swagger.annotations.Extension.
Read more >swagger @ApiModelProperty example value for List<String ...
I managed to get this to work, generating a List of Strings. Within the ApiModelProperty with springfox 2, write your example as follows:...
Read more >@io.swagger.annotations.ApiModelProperty(value = Whether or not ...
java code examples for @io.swagger.annotations.ApiModelProperty(value = Whether or not the extension has additional detail documentation).
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I got this working by making a ModelPropertyBuilderPlugin that looks at the annotations:
It’s basically so that we can add extra information to the documentation, such as saying that this property is dependant on another, for example
which could then be used by a secondary swagger parser to highlight in documentation that providing a preference property is dependent on the vehicle property being set to car, as then the swagger output would be something like:
I believe that it was implemented into Swagger here: https://github.com/swagger-api/swagger-core/pull/2424