I am using The openapi-generator-maven-plugin:6.4.0 to generate swagger code. I am able to access the APIs.
But, in generated files @ExampleObject is not present. Also, in Swagger UI I am unable to see the examples specified in inputSpec. Please suggest.
Below are the dependencies and plugins used in pom.xml file
Dependencies:
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-ui</artifactId>
<version>1.6.14</version>
</dependency>
<dependency>
<groupId>org.openapitools</groupId>
<artifactId>jackson-databind-nullable</artifactId>
<version>0.2.1</version>
</dependency>
Plugin:
<plugin>
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<version>6.4.0</version>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<inputSpec>/src/main/resources/openapi.json</inputSpec>
<apiPackage>com.example.api</apiPackage>
<modelPackage>com.example.model</modelPackage>
<skipOperationExample>false</skipOperaionExample> <generatorName>spring</generatorName>
<configOptions> <sourceFolder>src/gen/java/main</sourceFolder<delegatePattern>true</delegatePattern>
<interfaceOnly>true</interfaceOnly>
</configOptions>
</configuration>
</execution>
</executions>
</plugin>
you can use
<plugin>
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<version>6.6.0</version>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<inputSpec>${project.basedir}/misc/spec/SOP.yml</inputSpec>
<generatorName>java</generatorName>
<generateApiDocumentation>false</generateApiDocumentation>
<generateApiTests>false</generateApiTests>
<generateModelDocumentation>false</generateModelDocumentation>
<generateModelTests>false</generateModelTests>
<generateApiTests>false</generateApiTests>
<generateSupportingFiles>false</generateSupportingFiles>
<library>resttemplate</library>
<modelPackage>com.abc.omsvclyr.gen.sop</modelPackage>
<configOptions>
<interfaceOnly>true</interfaceOnly>
<useJakartaEe>true</useJakartaEe>
<sourceFolder>src/java/main</sourceFolder>
<generateApis>false</generateApis>
<useSpringBoot3>true</useSpringBoot3>
</configOptions>
</configuration>
</execution>
</executions>
</plugin>