Using @RequestParam annotated method with swagger ui
This was caused by the line enableUrlTemplating(true) in Docket configuration which I copied from example and forgot to remove. After removing this line everything is working as expected.
This was caused by the line enableUrlTemplating(true) in Docket configuration which I copied from example and forgot to remove. After removing this line everything is working as expected.
I had given up and went to use Spring Boot 2.7 after posting the question. But, after seeing Dmitriy’s answer though, I checked Springdoc one last time and found that Springdoc v2 does support Spring Boot 3. Essentially, one has to place the following in their pom: <dependency> <groupId>org.springdoc</groupId> <artifactId>springdoc-openapi-starter-webmvc-ui</artifactId> <version>2.0.0</version> </dependency> Then one can … Read more
@Bean public Docket newsApi(ServletContext servletContext) { return new Docket(DocumentationType.SWAGGER_2).pathProvider(new RelativePathProvider(servletContext) { @Override public String getApplicationBasePath() { return “/serviceName” + super.getApplicationBasePath(); } }).host(“proxyURL”); }
Fixed!!! The issue exists as spring fox libraries internally depend on spring-plugin-core:1.2.0 but it actually requires spring-plugin-core:2.0.0. This dependency correction seems to be missing in the SNAPSHOT version of the swagger libraries for supporting web flux. We just need to correct Maven dependencies as given below and no code change is required: Maven POM Dependencies … Read more
You could use the globalOperationParametersin the docket definition. For e.g. new Docket(…) .globalOperationParameters( Arrays.asList(new ParameterBuilder() .name(“header”) .description(“Description of header”) .modelRef(new ModelRef(“string”)) .parameterType(“header”) .required(true) .build())) See #22 in the documentation for more information.
The /v2/api-docs URL is the default that SpringFox uses for documentation. The v2 does not refer to your API’s documentation version (which can be changed in the Docket configuration), but the version of the Swagger specification being used. Take a look at the documentation here for customizing the Swagger documentation URL. In short, you need … Read more
Only adding @EnableWebMvc in main class resolved the problem: @EnableWebMvc @SpringBootApplication public class MyApp { public static void main(String[] args) { SpringApplication.run(MyApp.class); } }
Add in the security config — following URLS that are skipped for authentication :: private static final String[] AUTH_WHITELIST = { “/swagger-resources/**”, “/swagger-ui.html”, “/v2/api-docs”, “/webjars/**” }; @Override public void configure(WebSecurity web) throws Exception { web.ignoring().antMatchers(AUTH_WHITELIST); }
I managed to get this to work, generating a List of Strings. Within the ApiModelProperty with springfox 2, write your example as follows: example = “[\”AddLine1\”,\”AddLine2\”,\”AddLine3\”,\”AddLine4\”]” Here is my example: @ApiModelProperty(value = “Address”, name = “addLines”, example = “[\”AddLine1\”,\”AddLine2\”,\”AddLine3\”,\”AddLine4\”]”) When I render the swagger page, I get the following output: “addLines”: [ “AddLine1”, “AddLine2”, “AddLine3”, … Read more
Springfox 3.0.0 only works with Spring Boot <= 2.6.0-M2 but not with versions above it Options for Spring Boot 2.6 M2 < 1. spring.mvc.pathmatch.matching-strategy=ANT_PATH_MATCHER #-> App.properties – But without Actuator 2. @EnableWebMvc 3. Migrate to springdoc-openapi-ui – same steps as io.springfox >= 3.X io.springfox >= 2.X io.springfox >= 3.X <dependency> <groupId>io.springfox</groupId> <artifactId>springfox-swagger-ui</artifactId> <version>2.9.2</version></dependency><dependency> <groupId>io.springfox</groupId> <artifactId>springfox-swagger2</artifactId> … Read more