cancel
Showing results for 
Search instead for 
Did you mean: 

Swagger Core 2.x OpeanAPI 3 Examples tied to Dataclass(variables)

New Contributor

Swagger Core 2.x OpeanAPI 3 Examples tied to Dataclass(variables)

I'd like to to add examples to my OpenAPI 3 Autogenerated Documentation which I generate with "io.swagger.core.v3.swagger-gradle-plugin"

I didn't find a way to bind the example to the variable of my dataclass, like you could do with @ApiModelProperty for a swagger V2 file.

All I found is @ExampleObject which you have to define for each response as a String. Am I missing something or is that the only way to add Examples to a swagger.v3 approach?

1 REPLY 1
Highlighted
New Contributor

Re: Swagger Core 2.x OpeanAPI 3 Examples tied to Dataclass(variables)

I found it out myself, you need the @Schema annotation and not the @Parameter annotation, moreover it ignores the variables and only uses the Getter and Setter to generate the YAML.

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