When using openapi-generator-maven-plugin to generate sources with a yaml spec present in another jar, the models and other operation files are generated successfully but towards the end FileNotFoundException is thrown. Probably this might be due to classloader.
4.0.0-beta
...
<plugin>
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<version>4.0.0-beta</version>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<inputSpec>/openapi.yaml</inputSpec>
<language>spring</language>
<library>spring-mvc</library>
<configOptions>
<useTags>false</useTags>
<invokerPackage>${project.groupId}.backend.generated.server</invokerPackage>
<apiPackage>${project.groupId}.backend.generated.server.api</apiPackage>
<modelPackage>${project.groupId}.backend.generated.server.model</modelPackage>
</configOptions>
<modelNameSuffix>Model</modelNameSuffix>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>${swagger.spec.artifactId}</artifactId>
<version>${swagger.spec.version}</version>
</dependency>
</dependencies>
</plugin>
...
Probable solution would be to use something similar to
this.getClass().getClassLoader().getResourceAsStream(inputSpec)
instead of
File inputSpecFile = new File(inputSpec);
at following line
馃憤 Thanks for opening this issue!
馃彿 I have applied any labels matching special text in your issue.
The team will review the labels and make any necessary changes.
I think the same line of code is breaking remote inputSpecs? If the inputSpec is a URL then it also breaks with a FileNotFoundException (naturally because a url isn't a file).
Same here. It would also be nice to use an external server address as inputSpec, like WSDL stub generation works.
E.g.
<inputSpec>https://petstore.swagger.io/v2/swagger.json</inputSpec>
Please give it another try as #3440 has been merged into master
Most helpful comment
I think the same line of code is breaking remote
inputSpecs? If theinputSpecis a URL then it also breaks with aFileNotFoundException(naturally because a url isn't a file).