Java/Spring Server-Stubs Generation with swagger-codegen-maven-plugin
In my Spring Boot Java project I am using swagger-codegen-maven-plugin to generate the Spring MVC controller interfaces (server stubs) from my Swagger 2.0 api.yml. The integration in the maven build process is quite simple. It works simliar as I used to do it with the jaxws-maven-plugin for WSDLs. This is the example configuration from the pom.xml with swagger-codegen. It generates the server side model and mvc interfaces:
<plugin>
<groupId>io.swagger</groupId>
<artifactId>swagger-codegen-maven-plugin</artifactId>
<version>2.2.3</version>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<inputSpec>/api/api-v2.yml</inputSpec>
<language>spring</language>
<apiPackage>io.fischermatte.test.api</apiPackage>
<modelPackage>io.fischermatte.test.api.model</modelPackage>
<output>${project.build.directory}/generated</output>
<configOptions>
<interfaceOnly>true</interfaceOnly>
<sourceFolder>/src/main/java</sourceFolder>
<library>spring-mvc</library>
<dateLibrary>java8</dateLibrary>
</configOptions>
</configuration>
</execution>
</executions>
</plugin>
But how to integrate the same thing in a npm build process of a client angular app ?
Now I am trying to integrate the generation of the client code in the npm build process of my angular app. I have an api.yml defining my rest endpoints based on Swagger 2.0. I want the npm build to generate the api module similar to this typescript-angular-v4.3 sample. As much as I have seen, there is no official package for npm that does this like swagger-codegen-maven-plugin is doing it when you are using maven.
Did I misunderstand something here? The sample mentioned above is already the outcome, but what is the recommended approach to get there? Is such an integration in a npm based project not the way to go? Should one do it manually and check the generated typescript files into the sources directory?