cancel
Showing results for 
Search instead for 
Did you mean: 

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

SOLVED
Occasional Contributor

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

 

1 ACCEPTED SOLUTION

Accepted Solutions
Occasional Contributor

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

@frantuma Thanks a lot, it really helped Smiley Happy

2 REPLIES 2
Highlighted
Staff

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

you would use allowableValues e.g.

 

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

 

Occasional Contributor

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

@frantuma Thanks a lot, it really helped Smiley Happy

New Here?
Join us and watch the welcome video:
Top Kudoed Authors