Swagger generating code from YAML spec without annotations

Viewed 1160

I am generating Java 8 code from yaml file specifying my REST API. Models generated with some swagger annotations that I want to get rid of. Is it possible somehow? And maybe it will be possible in the nearest future ?

Rest models will be traveling through Camle routes, so I would like to use jaxrs annotations if any..

I am using openapi 3.0.0 version, so I have to use newest swagger maven codegen plugin (which I find 3.0.0-rc1 in maven repository)

I just don't want to have swagger specific annotations in classes. I used:

<generateModelDocumentation>false</generateModelDocumentation>

The generated model:

   import io.swagger.annotations.ApiModel; //THIS IS NOT COMPILING and i dont need annotated models, just simple pojo classes or maybe some jaxb annotations instead swagger specific..
    import io.swagger.annotations.ApiModelProperty;

    /**
     * The requested data to the service.
     */@ApiModel(description = "The requested data to the service.")
    @javax.annotation.Generated(value = "io.swagger.codegen.languages.java.JavaClientCodegen", date = "*****")
    public class MyCustomRequest {

........

}

The pom.xml plugin:

  <plugin>
                    <groupId>io.swagger</groupId>
                    <artifactId>swagger-codegen-maven-plugin</artifactId>
                    <version>3.0.0-rc1</version>
                    <executions>
                        <execution>
                            <goals>
                                <goal>generate</goal>
                            </goals>
                            <configuration>


<inputSpec>${project.basedir}/swagger/MyCustomSpecification.yaml</inputSpec>
                        <language>java</language>
                        <configOptions>
                            <dateLibrary>java8</dateLibrary>
                            <java8>true</java8>
                            <interfaceOnly>true</interfaceOnly>
                            <useJaxbAnnotations>false</useJaxbAnnotations>
                        </configOptions>
                        <generateApis>false</generateApis>
                        <generateApiTests>false</generateApiTests>
                        <generateModelTests>false</generateModelTests>
                        <generateModelDocumentation>false</generateModelDocumentation>
                        <generateSupportingFiles>false</generateSupportingFiles>
                        <generateApiDocumentation>false</generateApiDocumentation>
                        <modelPackage>${project.groupId}.swagger.model</modelPackage>
                        <apiPackage>${project.groupId}.swagger.api</apiPackage>
                        <invokerPackage>${project.groupId}.swagger.invoker</invokerPackage>
                        <library>resttemplate</library>
                    </configuration>
                </execution>
            </executions>
        </plugin>
0 Answers
Related