Forum Discussion

bogdanp's avatar
bogdanp
Occasional Contributor
6 years ago

enums not generated in YAML file using swagger-maven-plugin

Hello SmartBear community,

 

I am using swagger-maven-plugin to generate a YAML file based on openAPI annotations.

https://github.com/swagger-api/swagger-core/tree/master/modules/swagger-maven-plugin

 

There is a problem with the enumeration annotation (enums): I do not know how to write it 

using io.swagger.v3.oas.annotations, so in the end the YAML output file is not generated properly.

 

public Response methodName(
@Parameter(description = ".....")
@Parameter(in = ParameterIn.QUERY, description = FILTER_DESCRIPTION,
example = ".....",
schema = @Schema(
type = "string",
description = ".....",
enumeration = "{\".....\", \".....\", \".....\"}"))
example = "{\".....\", \".....\", \".....\"}"))
.............

Do you have any suggestion in how to solve this?

Smiley Happy

Bogdan

 

  • you would use allowableValues e.g.

     

    @Schema(..., allowableValues = {"1", "2"})