You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
When either the request or response payloads are subclasses in a class hierarchy, the generated OpenAPI UI content does not render the schemas for subclasses, when the Spring Boot app is built and run as a native image using Spring Native and GraalVM. The schemas are rendered properly when the same code is run under non-native, JVM mode.
To Reproduce
Steps to reproduce the behavior:
What version of spring-boot you are using?
2.5.4
What modules and versions of springdoc-openapi are you using?
springdoc-openapi-ui 1.5.10
springdoc-openapi-security 1.5.10
What is the actual and the expected result using OpenAPI Description (yml or json)?
Provide with a sample code (HelloController) or Test that reproduces the problem
@GetMapping("/children/{childId}")
@Operation(summary = "Get child by child ID")
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "Found the child"),
@ApiResponse(responseCode = "404", description = "Child not found", content = @Content)
})
public AbstractChild byChildId(@PathVariable("childId") String childId) {
return childrenRepo.findFirstByChildId(childId).orElseThrow(() -> new ResponseStatusException(HttpStatus.NOT_FOUND, "No child found"));
}
Note: ChildA, ChildB and ChildC are concrete subclasses of AbstractChild
Expected behavior
The behavior should be the same when the code is run in non-native JVM mode, as well as when the code is built and run as native image using GraalVM and Spring Native. Currently, the non-native JVM mode correctly renders the schema for the class hierarchy in the "schema: oneOf" format, whereas the native build does not generate any schema for the subclasses.
Additional context
Spring Boot 2.5.4
Spring API Doc 1.5.10
Spring Native 0.10.3
GraalVM CE 21.2.0 (build 11.0.12+6-jvmci-21.2-b08
The text was updated successfully, but these errors were encountered:
@bnasslahsen , I can confirm that the latest v1.5.11-SNAPSHOT fixes the issue I reported. The subclass schema is now generated properly by my native image build. Thanks!
Describe the bug
When either the request or response payloads are subclasses in a class hierarchy, the generated OpenAPI UI content does not render the schemas for subclasses, when the Spring Boot app is built and run as a native image using Spring Native and GraalVM. The schemas are rendered properly when the same code is run under non-native, JVM mode.
To Reproduce
Steps to reproduce the behavior:
What version of spring-boot you are using?
2.5.4
What modules and versions of springdoc-openapi are you using?
springdoc-openapi-ui 1.5.10
springdoc-openapi-security 1.5.10
What is the actual and the expected result using OpenAPI Description (yml or json)?
Expected:
{"content":{"application/json":{"schema":{"oneOf":[{"$ref":"#/components/schemas/ChildA"},{"$ref":"#/components/schemas/ChildB"},{"$ref":"#/components/schemas/ChildC"}]}}},"required":true}
Actual:
{"content":{"application/json":{"schema":{},"exampleSetFlag":false}}
Provide with a sample code (HelloController) or Test that reproduces the problem
Note: ChildA, ChildB and ChildC are concrete subclasses of AbstractChild
Expected behavior
The behavior should be the same when the code is run in non-native JVM mode, as well as when the code is built and run as native image using GraalVM and Spring Native. Currently, the non-native JVM mode correctly renders the schema for the class hierarchy in the "schema: oneOf" format, whereas the native build does not generate any schema for the subclasses.
Additional context
Spring Boot 2.5.4
Spring API Doc 1.5.10
Spring Native 0.10.3
GraalVM CE 21.2.0 (build 11.0.12+6-jvmci-21.2-b08
The text was updated successfully, but these errors were encountered: