With openapi-generator-maven-plugin how can I generate an interface with keeping the order of the paths

430 views Asked by At

I am using openapi-generator-maven-plugin to generate an interface, like this:

<plugin>
    <groupId>org.openapitools</groupId>
    <artifactId>openapi-generator-maven-plugin</artifactId>
    <version>6.2.1</version>
    <executions>
         <execution>
             <id>server</id>
             <goals>
                 <goal>generate</goal>
             </goals>
             <configuration>
                 <inputSpec>src/main/resources/api/api.yaml</inputSpec>
                 <apiPackage>com.test.api</apiPackage>
                 <modelPackage>com.test.api.model</modelPackage>
                 <output>target/generated-sources/openapi</output>
                 <generatorName>spring</generatorName>
                 <library>spring-boot</library>
                 <groupId>com.test</groupId>
                 <artifactId>api</artifactId>
                 <artifactVersion>${project.version}</artifactVersion>
                 <configOptions>
                     <useTags>true</useTags>
                     <interfaceOnly>true</interfaceOnly>
                     <dateLibrary>java8</dateLibrary>
                     <serializableModel>true</serializableModel>
                 </configOptions>
                 <typeMappings>
                     <typeMapping>LocalDate=java.time.ZonedDateTime</typeMapping>
                 </typeMappings>
                 <importMappings>
                     <importMapping>java.time.LocalDate=java.util.Date</importMapping>
                 </importMappings>
             </configuration>
         </execution>
    </executions>
</plugin>

But the interface generated contains the methods defined by the paths in the yaml file in a kind of randomized order.

So when I use springdoc-openapi-starter-webmvc-ui to make the Swagger UI, paths are in the order as in the generated interface, not as in the original yaml file.

0

There are 0 answers