'Hidden parameter in springdoc-openapi doesn't work

I have Spring Boot application with version 2.3.0. and springdoc-openapi-webflux-ui in version 1.4.1.

I have annotated parameter in operation like this.

parameters = {
@Parameter(
    hidden = true, schema = @Schema(implementation = Boolean.class),
    in = ParameterIn.QUERY, name = DO_NOT_FORWARD
)

With hidden = true I expected that this parameter will not be visible in swagger-ui. But it is. Did I misunderstood this parameter or is it not doing what it was supposed to do?

I want this parameter to be in api-docs, to have generated client able to use this parameter, but I want it invisible in swagger-ui



Solution 1:[1]

You just make sure that the name of in the @Parameter annotation, is the exact name of the operation parameter you want to hide.

You can have a look at the documentation as well:

If you are still having coniguration issue, you can add the code of sample HelloController that reproduces your problem, or you can add the link to a minimal, reproducible sample in github.

Solution 2:[2]

Try

@Parameter(name = "paramName", hidden = true)
@GetMapping("/example")
public Object example(String paramName) {
    return null;
}

instead of

@Operation(
    parameters = {
        @Parameter(name = "paramName", hidden = true)
    }
)
@GetMapping("/example")
public Object example(String paramName) {
    return null;
}

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 brianbro
Solution 2 István Békési