3

i am packaging my swagger yaml file in it's own project, which gets packaged as a jar uploaded to our maven repository. With the swagger file and the swagger-maven-codegen-plugin it should be possible for the clients to generate their nedded models from the swagger file.

How can clients access the swagger file located inside the jar under static/swagger.yaml? Only if they declared it as a dependency of course.

Example for clients:

<build>
        <plugins>
            <plugin>
                <groupId>io.swagger.codegen.v3</groupId>
                <artifactId>swagger-codegen-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <goals>
                            <goal>generate</goal>
                        </goals>
                        <configuration>
                            <inputSpec>path/to/yaml/in/jar.yaml</inputSpec> <!-- CORRECT PATH? -->
                            <language>spring</language>
                            <modelPackage>com.dos.search.api</modelPackage>
                            <apiPackage>com.dos.search.api</apiPackage>

                            <language>spring</language>
                            <generateSupportingFiles>false</generateSupportingFiles>
                            <withXml>false</withXml>
                            <generateApis>true</generateApis>

                            <generateModelDocumentation>false</generateModelDocumentation>
                            <generateApiDocumentation>false</generateApiDocumentation>
                            <generateApiTests>false</generateApiTests>
                            <generateModelTests>false</generateModelTests>
                            <generateModels>true</generateModels>

                            <configOptions>
                                <library>spring-boot</library>
                                <java8>true</java8>
                                <dateLibrary>java8</dateLibrary>
                                <hideGenerationTimestamp>true</hideGenerationTimestamp>
                                <useTags>true</useTags>
                                <useBeanValidation>true</useBeanValidation>
                                <interfaceOnly>true</interfaceOnly>
                                <delegatePattern>false</delegatePattern>
                                <hideGenerationTimestamp>true</hideGenerationTimestamp>
                            </configOptions>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
Dos
  • 67
  • 7

0 Answers0