How do I only generate interfaces of the APIs?
Asked Answered
H

1

8

I am trying to generate the interfaces only with OpenApi and their maven plugin openapi-generator-maven-plugin but it also generates the full services with it that I don't want/need.

Now I have found the withInterfaces propery but when set to true, it also generates the API services. So it generates what I want but also the services I don't want.

Here is my pom config:

<plugin>
    <groupId>org.openapitools</groupId>
    <artifactId>openapi-generator-maven-plugin</artifactId>
    <version>3.3.4</version>
    <executions>
        <execution>
            <goals>
                <goal>generate</goal>
            </goals>
            <configuration>
                <inputSpec>${openAPIContractsDirectory}/swagger.json</inputSpec>
                <generatorName>typescript-angular</generatorName>
                <output>${openAPIOutputDirectory}</output>
                <configOptions>
                    <ngVersion>7.2.11</ngVersion>
                    <withInterfaces>true</withInterfaces>
                </configOptions>
                <generateApiTests>false</generateApiTests>
                <generateApiDocumentation>false</generateApiDocumentation>
                <generateModelTests>false</generateModelTests>
                <generateModelDocumentation>false</generateModelDocumentation>
                <supportingFilesToGenerate>variables.ts,configuration.ts,encoder.ts</supportingFilesToGenerate>
            </configuration>
        </execution>
    </executions>
</plugin>

What I want is the models, some of the supporting files described in the pom, and ONLY the API interfaces (not the completed services).

Would anyone have any idea how to do this?

Hardworking answered 16/4, 2019 at 13:39 Comment(0)
R
6

add this inner section to plugin configuration

<configuration>
   ......
   ......
   <configOptions>
        <interfaceOnly>true</interfaceOnly>
    </configOptions>
</configuration>
Raama answered 25/3, 2021 at 8:31 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.