swagger

How to hide a request field in Swagger API

血红的双手。 提交于 2020-08-27 08:18:19
问题 I want to hide the "id" item in the model, how to do this in java? 回答1: to hide a request field in Swagger API just use the annotation below :) @ApiModelProperty(hidden = true) private String id; And it will be hive 回答2: @JsonProperty(access = JsonProperty.Access.READ_ONLY) @ApiModelProperty(readOnly = true) private String id; Also see: https://github.com/springfox/springfox/issues/2816 回答3: You can use @Hidden with Swagger Core 2.X @Hidden -- Hides a resource, an operation or a property

Swagger-ui anchor link to model definitions

社会主义新天地 提交于 2020-08-24 06:43:59
问题 Is it possible to access a model definition of via swagger-ui directly via an anchor? In the example page http://petstore.swagger.io/ I see that the anchor works for a groups of endpoints, e.g. http://petstore.swagger.io/#/pet. Hovering the mouse over a model description shows me an anchor (e.g. #/definitions/Category for the Category model), but http://petstore.swagger.io/#/definitions/Category does not bring me there. If I inspect the elements, I see a real link to anchor pet : <a class=

Swagger-ui anchor link to model definitions

浪尽此生 提交于 2020-08-24 06:43:06
问题 Is it possible to access a model definition of via swagger-ui directly via an anchor? In the example page http://petstore.swagger.io/ I see that the anchor works for a groups of endpoints, e.g. http://petstore.swagger.io/#/pet. Hovering the mouse over a model description shows me an anchor (e.g. #/definitions/Category for the Category model), but http://petstore.swagger.io/#/definitions/Category does not bring me there. If I inspect the elements, I see a real link to anchor pet : <a class=

SpringFox - Hide certain fields in Swagger-ui that aren't required for the call to an endpoint

六眼飞鱼酱① 提交于 2020-08-23 07:48:49
问题 I would like to know if there is any way of making SpringFox to not show all the fields of a certain entity that aren't required in the call to an specific endpoint. For example: Having the following entity: public class Car { long id; String name; int wheels; String type; boolean canFly; } And the following endpoints: @RequestMapping(method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) public Car get(@RequestParam(value = "carId", required = true) long projectId) { return