-
-
Notifications
You must be signed in to change notification settings - Fork 553
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug
We're trying to upgrade JHipster from Spring Docs 1.5.13 to 1.6.0. The following tests pass with 1.5.13 but fail with 1.6.0.
@Test
void generatesOAS() throws Exception {
mockMvc.perform(get("/v3/api-docs"))
.andExpect((status().isOk()))
.andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE))
.andExpect(jsonPath("$.info.title").value("test title"))
.andExpect(jsonPath("$.info.description").value("test description"))
.andExpect(jsonPath("$.info.version").value("test version"))
.andExpect(jsonPath("$.info.termsOfService").value("test tos url"))
.andExpect(jsonPath("$.info.contact.name").value("test contact name"))
.andExpect(jsonPath("$.info.contact.url").value("test contact url"))
.andExpect(jsonPath("$.info.contact.email").value("test contact email"))
.andExpect(jsonPath("$.info.license.name").value("test license name"))
.andExpect(jsonPath("$.info.license.url").value("test license url"))
.andExpect(jsonPath("$.paths./scanned/test").exists())
.andExpect(jsonPath("$.paths./not-scanned/test").doesNotExist())
// TODO: fix bug in Springfox
//.andExpect(jsonPath("$.servers.[*].url").value(hasItem("test server url")))
.andExpect(jsonPath("$.servers.[*].url").value(hasItem("http://localhost")));
}
@Test
void setsPageParameters() throws Exception {
mockMvc.perform(get("/v3/api-docs"))
.andExpect((status().isOk()))
.andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE))
.andExpect(jsonPath("$.paths./scanned/test.get.parameters[?(@.name == 'page')]").exists())
.andExpect(jsonPath("$.paths./scanned/test.get.parameters[?(@.name == 'page')].in").value("query"))
.andExpect(jsonPath("$.paths./scanned/test.get.parameters[?(@.name == 'page')].schema.type").value("integer"))
.andExpect(jsonPath("$.paths./scanned/test.get.parameters[?(@.name == 'size')]").exists())
.andExpect(jsonPath("$.paths./scanned/test.get.parameters[?(@.name == 'size')].in").value("query"))
.andExpect(jsonPath("$.paths./scanned/test.get.parameters[?(@.name == 'size')].schema.type").value("integer"))
.andExpect(jsonPath("$.paths./scanned/test.get.parameters[?(@.name == 'sort')]").exists())
.andExpect(jsonPath("$.paths./scanned/test.get.parameters[?(@.name == 'sort')].in").value("query"))
.andExpect(jsonPath("$.paths./scanned/test.get.parameters[?(@.name == 'sort')].schema.type").value("array"))
.andExpect(jsonPath("$.paths./scanned/test.get.parameters[?(@.name == 'sort')].schema.items.type").value("string"));
}Error is:
org.springframework.web.util.NestedServletException: Request processing failed; nested exception is
java.lang.NullPointerException: Cannot invoke "java.util.List.removeIf(java.util.function.Predicate)"
because the return value of "io.swagger.v3.oas.models.OpenAPI.getTags()" is null
To Reproduce
Steps to reproduce the behavior:
- What version of spring-boot you are using? 2.6.1
- What modules and versions of springdoc-openapi are you using? 1.6.0
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-webmvc-core</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-webflux-core</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-data-rest</artifactId>
<optional>true</optional>
</dependency>- Provide with a sample code (HelloController) or Test that reproduces the problem
git clone -b skip_ci-spring-boot-2.6.0 [email protected]:jhipster/jhipster-bom.git
cd jhipster-bom
./mvnw install -Dgpg.skip=true
Expected behavior
Tests pass as they do with 1.5.13.
Additional context
Related JHipster PR: jhipster/jhipster-bom#500
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working