PR for openapi-generator-maven-plugin inputSpec -- Allow jar: URLs
This is a PR in response to #10016. It changes <inputSpec/> processing to:
- Search a classpath of Maven compilation dependencies for resources.
- Allow URLs of the form jar:jar-file-specific-url!/spec.yaml
In the case that a compilation classpath resource is specified, the resource URL is passed to the swagger-parser OpenAPIV3Parser instead of the <inputSpec/> string since the OpenAPIV3Parser does not have access to the Maven compilation classpath. This requires https://github.com/swagger-api/swagger-parser/issues/1592 and https://github.com/swagger-api/swagger-parser/pull/1593.
modules/openapi-generator-maven-plugin/src/test/java/org/openapitools/codegen/plugin/CodeGenMojoTest.java has been expanded to include tests for resource and URL input specs.
(This is a copy of PR #10037. I've rebased original branch on master, fixed merge conflicts and removed swagger-parser 2.0.28-SNAPSHOT since 2.1.19 is used now)
CC @wing328, @jimschubert
can you please also add a test or 2 in https://github.com/OpenAPITools/openapi-generator/blob/master/.github/workflows/maven-plugin-tests.yaml#L44 ?
can you please also add a test or 2 in https://github.com/OpenAPITools/openapi-generator/blob/master/.github/workflows/maven-plugin-tests.yaml#L44 ?
Will do so. I have to fix other tests, also. I have so issues to run the build locally.
@wing328 instead of adding another pom to https://github.com/OpenAPITools/openapi-generator/blob/master/.github/workflows/maven-plugin-tests.yaml#L44 , I've extended https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator-maven-plugin/examples/java-client.xml with another execution, pointing to a jar as inputSpec.
There are also tests in CodeGenMojoTest.java. For inputSpec as classpath, url or file there are other examples and tests, thus I did not additional examples.
@parenko thanks for the PR, which has been merged into the master.