Skip to content

oneOf schema not generated > 2.3.0 #2575

Closed
@ebcFlagman

Description

@ebcFlagman

We have a Exception handler which can handle oneOf subclasses of a exception. But since springdoc version > 2.3.0 we have the problem, that this schemas no longer be generated.

    @ExceptionHandler(ApiException.class)
    @ApiResponse(
        responseCode = "400",
        description = "Bad Request",
        content = @Content(
            mediaType = BaseController.API_V3_JSON,
            schema = @Schema(oneOf = {
                ExceptionResponse.class,
                EsbException.EsbExceptionResponse.class,
                ValidationException.ValidationExceptionResponse.class})))
    @ApiResponse(
        responseCode = "404",
        description = "Not found",
        content = @Content(
            mediaType = BaseController.API_V3_JSON,
            schema = @Schema(oneOf = {
                ExceptionResponse.class,
                EsbException.EsbExceptionResponse.class})))
    @ApiResponse(
        responseCode = "500",
        description = "Internal Server Error",
        content = @Content(
            mediaType = BaseController.API_V3_JSON,
            schema = @Schema(oneOf = {
                ExceptionResponse.class,
                EsbException.EsbExceptionResponse.class})))
    @ApiResponse(
        responseCode = "504",
        description = "Gateway Timeout, the connection to the ESB timed out",
        content = @Content(
            mediaType = BaseController.API_V3_JSON,
            schema = @Schema(implementation = ExceptionResponse.class)))
    public ResponseEntity<ExceptionResponse> processApiException(ApiException exception) {
        log.error(exception.toString());
        return new ResponseEntity<>(exception.getExceptionResponse(environment), exception.getStatus());
    }

In the swagger-ui we see then this error

image

I didn't found anything related in the release notes of 2.4.0, are we missing something?

Metadata

Metadata

Assignees

No one assigned

    Labels

    duplicateThis issue or pull request already exists

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions