Skip to content

[swagger-codegen-maven-plugin] custom module/generator/language not possible? #2923

@sreich

Description

@sreich

trying to create a custom generator, the examples only show how to do it from the cli (generate the library, pass it to the swagger-cli). which is great, except i'm using the maven plugin.

i tried creating a jar and adding it as a dependency to that plugin, but it doesn't seem to recognize the language as valid. if what i am doing is actually possible, please also provide a simple example (like put it in the readme for maven plugin)

essentially:

        <plugin>
            <groupId>io.swagger</groupId>
            <artifactId>swagger-codegen-maven-plugin</artifactId>
            <version>${swagger-codegen-maven-plugin-version}</version>
            <executions>
                <execution>
                    <goals>
                        <goal>generate</goal>
                    </goals>
                    <configuration>
                        <inputSpec>src/main/resources/yaml/testyamlfilename.yaml</inputSpec>
                        <language>custom-java</language>


                        <output>${project.build.directory}/generated-sources</output>
                        <apiPackage>${default.package}.handler</apiPackage>
                        <modelPackage>${default.package}.model</modelPackage>
                        <invokerPackage>${default.package}.handler</invokerPackage>
                    </configuration>
                </execution>
            </executions>

            <dependencies>
                <dependency>
                    <groupId>com.my.templates</groupId>
                    <artifactId>swagger-templates</artifactId>
                    <version>0.1-SNAPSHOT</version>
                </dependency>
            </dependencies>

        </plugin>
Swagger-codegen version

swagger-codegen-maven-plugin 2.1.6

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions