Description:
In versions prior to 2.8.0 of springdoc-openapi, using @Header with @Schema(type = "string") correctly generated the expected schema in the OpenAPI documentation.
However, starting with 2.8.0, the generated schema became incorrect, and as of 2.8.6 it results in a completely empty schema.
Reproducer Example:
@ApiResponse(
responseCode = "201",
description = "Created",
headers = {
@Header(name = "Location", required = true, schema = @Schema(type = "string"))
}
)
Expected OpenAPI Output (as seen with 2.7.0):
headers:
Location:
required: true
schema:
type: string
style: simple
Actual Output:
headers:
Location:
required: true
schema:
example: null
style: simple
headers:
Location:
required: true
schema: {}
style: simple
Workaround:
Switching to implementation = String.class fixes the issue:
@Header(name = "Location", required = true, schema = @Schema(implementation = String.class))
This produces the correct OpenAPI YAML again.
Environment:
- springdoc-openapi version: 2.8.6
- Spring Boot version: 3.4.4
- Java version: OpenJDK 17
Additional Notes:
This seems to be a regression introduced in 2.8.0. The schema handling for headers appears to be broken when using type = "string", which previously worked. The problem did not exist in 2.7.0.
Please let me know if you need a full minimal sample project to reproduce.
Description:
In versions prior to 2.8.0 of springdoc-openapi, using
@Headerwith@Schema(type = "string")correctly generated the expected schema in the OpenAPI documentation.However, starting with 2.8.0, the generated schema became incorrect, and as of 2.8.6 it results in a completely empty schema.
Reproducer Example:
Expected OpenAPI Output (as seen with 2.7.0):
Actual Output:
Workaround:
Switching to
implementation = String.classfixes the issue:This produces the correct OpenAPI YAML again.
Environment:
Additional Notes:
This seems to be a regression introduced in 2.8.0. The schema handling for headers appears to be broken when using
type = "string", which previously worked. The problem did not exist in 2.7.0.Please let me know if you need a full minimal sample project to reproduce.