Skip to content

Tag: springfox

Replace @PathVariable object with ID only for Springdoc

I am currently trying to migrate from Springfox to Springdoc. Most of my endpoints contain a @PathVariable Instance. Obviously I am only passing in the ID of the instance and Spring would automatically resolve the object for me. Here is an example: Called as /api/myInstance/role. Springfox would handle this correctly for me, only generating {instance} as a String mapping to

HTTP not present on Schemes Swagger dropdown

I’m using springfox-swagger-ui and for whatever reason, only https scheme is available on the dropdown, even if I reach swagger ui through http. I can’t use https for the moment, so need that scheme enabled but couldn’t find anything on the documentation. Any idea why is this happening? Answer Add these following lines to your yaml page:

How to handle header field with swagger in a java project?

I want to add header parameters to swagger ui so that the user can pass these values also. Could someone guide on what the java code for this would look like. I am using springfox-swagger2 and springfox-swagger-ui version 2.9.x (There are other post of SOF that describe about adding these through swagger editor or are for other technologies, so they

springfox ApiModelProperty position sorting not working

In my spring boot application, I cannot be able to manage my swagger JSON with fields ordered properly on @ApiModel annotated class. Firstly, I imported springfox lib into my pom.xml: Secondly, I created Thirdly, I created my PersonDTO annotated by @ApiModel: Then, when I requesting for Json output at url http://localhost:[port]/[servlet-context-path]/v2/api-docs, it seems that the position order is not

Hiding unimportant getter methods from swagger UI in Java [duplicate]

This question already has answers here: How to hide a parameter in swagger? (9 answers) Closed 27 days ago. I have two fields in my class startDate and endDate of LocalDateTime. Internally, these need to be returned as Optional<ZonedDateTime>, while in the query they are provided as LocalDateTimes. Swagger (Springfox v2.9.2) now shows the needed fields but also endDateWithTimezone.present and