2

I have this open API annotation

    @GET
    @Operation(method = "Get orders", description = "GetOrdersRoute",
            parameters = {
                    @Parameter(in = ParameterIn.QUERY, name = "batchSize", required = true,
                            schema = @Schema(type = "")),
                    @Parameter(in = ParameterIn.QUERY, name = "fromDate", required = true),
                    @Parameter(in = ParameterIn.QUERY, name = "filter", required = true)},
            responses = {
                    @ApiResponse(description = "The order",
                            content = @Content(mediaType = "application/json",
                                    schema = @Schema(implementation = OrderDto.class)))})
    @Override
    public String handle(@Parameter(hidden = true) Request request, @Parameter(hidden = true) Response response) {
        return api.exec();
    }

It works. But when I add to @Parameter to @Schema any value like schema = @Schema(type = "integer")) I get an exception:

java.lang.NoSuchMethodError: org.apache.commons.lang3.math.NumberUtils.isCreatable(Ljava/lang/String;)Z

In other words: @Schema(type = "")) works fine but @Schema(type = "integer")) doesn't work.

And not only type parameter in @Schema annotation. Any override parameter in @Schema annotation throws this exception.

But @Schema in @ApiResponse works fine with any override parameter.

Pavel Petrashov
  • 1,073
  • 1
  • 15
  • 34

3 Answers3

0

I was getting the same issue today when using

@ApiResponse(
    responseCode = "200", 
    content = @Content(mediaType = "application/json", schema = @Schema(implementation = MyDto.class)), 
    description = "Returns MyDto.")

with io.swagger.v3.oas.annotations.media.Schema from swagger 2.1.9.

After trying different swagger versions (which were producing other errors in my setup), it worked when downgrading to swagger 2.0.10.

ulrich
  • 1,431
  • 3
  • 17
  • 46
0

I changed @Schema(type = "integer") by @Schema(implementation = Integer.class)

0

Add this Dependency

 <dependency>
            <groupId>io.swagger.core.v3</groupId>
            <artifactId>swagger-annotations</artifactId>
            <version>2.2.10</version>
 </dependency>
Ahmad R. Nazemi
  • 775
  • 10
  • 26