I am using openapi-generator-maven-plugin 6.6.0 to generate a rest api (design first). I checked the open-api.yaml file in the official editor, it shows no syntax error in the YAML and it shows the examples correctly.
When I generate the code with maven, all the examples are missing in swagger UI after deploying the service. Any idea why?
open-api.yaml:
openapi: 3.0.3
/user/getUserByName:
get:
tags:
- User
summary: Get User By Name
operationId: getUserByName
parameters:
- name: name
in: query
description: name
required: true
schema:
type: string
example: John
Maven Plugin:
<plugin>
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<version>${openapi-generator-maven-plugin.version}</version>
<executions>
<execution>
<id>server-sources</id>
<phase>generate-sources</phase>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<generatorName>spring</generatorName>
<generateApiDocumentation>true</generateApiDocumentation>
<library>spring-boot</library>
<inputSpec>${project.basedir}/src/main/resources/open-api.yaml</inputSpec>
<generateApiTests>false</generateApiTests>
<generateModelTests>false</generateModelTests>
<supportingFilesToGenerate>ApiUtil.java,SpringDocConfiguration.java</supportingFilesToGenerate>
<configOptions>
<delegatePattern>true</delegatePattern>
<useTags>true</useTags>
<dateLibrary>java8-localdatetime</dateLibrary>
</configOptions>
<packageName>xxx.service</packageName>
<apiPackage>xxx.api</apiPackage>
<modelPackage>xxx.model</modelPackage>
</configuration>
</execution>
</executions>
</plugin>
Swagger Versions:
<io.swagger.version>1.6.6</io.swagger.version>
<io.swagger.core.v3.version>2.2.8</io.swagger.core.v3.version>