Open gregopet opened 1 year ago
cc @MikeEdgar
We've come up with a workaround: we use openapi
generator to transpile the schema into a simple JSON which we then let Quarkus serve. For example:
<plugin>
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<executions>
<execution>
<id>openapi-export-version</id>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<generatorName>openapi</generatorName>
<inputSpec>${project.basedir}/src/main/resources/api/own/openapi.yaml</inputSpec>
<output>target/classes/META-INF</output>
<configOptions>
<outputFileName>openapi.json</outputFileName>
</configOptions>
</configuration>
</execution>
<execution>
<id>openapi</id>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<inputSpec>${project.basedir}/src/main/resources/api/own/openapi.yaml</inputSpec>
<output>target/generated-sources/openapi</output>
<apiPackage>org.acme.api</apiPackage>
<modelPackage>org.acme.model</modelPackage>
</configuration>
</execution>
</executions>
</plugin>
Describe the bug
We are heavy users of OpenAPI's references, specifically, we split paths and model definitions into separate files (see sample below). This works for generating the code, but fails for publishing: the
$ref
is simply output, with no substitution, and trying to fetch the references individually fails as well (404 is returned).A simple sample would look like this:
Expected behavior
I would either expect the definitions to be available at their respective URLs or the spec to include these references in the resulting schema.
Actual behavior
The $ref elements come through verbatim and their targets are not available.
How to Reproduce?
Install the OpenAPI support as per tutorial and add the two OpenAPI files I listed above. Start Quarkus and open http://localhost:8080/q/openapi?format=json
Output of
uname -a
orver
Linux *** 6.0.10-arch2-1 #1 SMP PREEMPT_DYNAMIC Sat, 26 Nov 2022 16:51:18 +0000 x86_64 GNU/Linux
Output of
java -version
openjdk version "17.0.1" 2021-10-19 OpenJDK Runtime Environment Temurin-17.0.1+12 (build 17.0.1+12) OpenJDK 64-Bit Server VM Temurin-17.0.1+12 (build 17.0.1+12, mixed mode, sharing)
GraalVM version (if different from Java)
not using Graal
Quarkus version or git rev
2.14.2.Final
Build tool (ie. output of
mvnw --version
orgradlew --version
)Apache Maven 3.8.6 (84538c9988a25aec085021c365c560670ad80f63)
Additional information
openapi-generator-maven-plugin
plugin version 6.2.1