I am trying to workout a generated server side Spring MVC code for a OpenApi 3.0.2 specification.
This is how one of the `paths' look like :-
paths:
/api/v1/int/integrations/{some-path-variable}/some-action:
get:
summary: Summary
description: How to change the generated Api/Controller class name?
operationId: methodName
tags:
- inventory
parameters:
- name: Authorization
other details....
The server side code get generated using the Maven plugin which is configured as :-
<plugin>
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<version>4.1.0</version>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<inputSpec>${project.basedir}/src/main/resources/open-api/myapi.yaml</inputSpec>
<generatorName>spring</generatorName>
<library>spring-boot</library>
<output>${project.build.directory}/generated-openapi/spring</output>
<generateApis>true</generateApis>
<addCompileSourceRoot>true</addCompileSourceRoot>
<artifactVersion>${project.version}</artifactVersion>
<groupId>com.company.division</groupId>
<artifactId>myapi-api</artifactId>
<generateApiTests>true</generateApiTests>
<modelPackage>com.company.division.myapi.generated.model</modelPackage>
<apiPackage>com.company.division.myapi.generated.api</apiPackage>
<generateApiDocumentation>true</generateApiDocumentation>
<configOptions>
<dateLibrary>java8</dateLibrary>
<java8>true</java8>
<interfaceOnly>true</interfaceOnly>
<reactive>false</reactive>
<useBeanValidation>true</useBeanValidation>
<performBeanValidation>true</performBeanValidation>
<useOptional>false</useOptional>
<serviceInterface>true</serviceInterface>
<serviceImplementation>false</serviceImplementation>
</configOptions>
</configuration>
</execution>
</executions>
</plugin>
As seen in the plugin configuration, I am only interesed in generating the model classes and Spring Controller Interfaces / API interfaces.
Problem
For the mentioned OpenAPI spec, the generated MVC Controller inerfaces is named as ApiApi
. I am guessing that is derived from the path's begining part. I could get rid of the /api/v1/int
part but that will generate interface named IntegrationsApi
but I wan't it to be named say InventoryApi
.
What option we have to control the generated controller interface?
--additional-properties=useTags=true
– Afterword