|
| 1 | +This feature introduces the capability to load OpenAPI specifications directly from Maven GAV dependencies that are packaged |
| 2 | +as YAML, JSON, JAR, ZIP files. |
| 3 | + |
| 4 | +== Overview |
| 5 | + |
| 6 | +OpenAPI specifications can now be specified as Maven GAV (GroupId:ArtifactId:Version) coordinates and use them directly for |
| 7 | +client generation. This allows developers to use external or prepackaged OpenAPI specifications as dependencies instead |
| 8 | +of embedding them directly in their projects. |
| 9 | + |
| 10 | +Key features included in this implementation: |
| 11 | + |
| 12 | +- Compatibility with YAML, JSON, JAR and ZIP formats containing OpenAPI specifications. |
| 13 | +- Configuration options to specify GAV dependencies via application properties. |
| 14 | +- Support for filtering dependencies by artifact ID and excluding specific GAVs. |
| 15 | + |
| 16 | +== Sample Configurations |
| 17 | + |
| 18 | +=== YAML or JSON specification |
| 19 | + |
| 20 | +To load an OpenAPI specification from a Maven GAV dependency in YAML or JSON format, you can use the following configuration: |
| 21 | + |
| 22 | +Add the dependency to your `pom.xml`: |
| 23 | +[source,xml] |
| 24 | +<dependency> |
| 25 | + <groupId>com.example</groupId> |
| 26 | + <artifactId>customer-openapi</artifactId> |
| 27 | + <version>1.0.0</version> |
| 28 | + <type>yaml</type> |
| 29 | +</dependency> |
| 30 | + |
| 31 | +GAV scanning is activated by default. YAML, YML and JSON types are supported. The default artifact ID filter is `.\*openapi.*`, |
| 32 | +so the above dependency will be picked up automatically. |
| 33 | + |
| 34 | +To configure the client generation process, add common options to your `application.properties` that reference to the GAV: |
| 35 | + |
| 36 | +e.g. |
| 37 | +[source,properties] |
| 38 | +quarkus.openapi-generator.codegen.spec.com_example_customer_openapi.serializable-model=true |
| 39 | + |
| 40 | +=== JAR or ZIP Files containing specification |
| 41 | +To load an OpenAPI specification from a Maven GAV dependency packaged as a JAR or ZIP file, use the following configuration: |
| 42 | + |
| 43 | +Add the dependency to your `pom.xml`: |
| 44 | +[source,xml] |
| 45 | +<dependency> |
| 46 | + <groupId>com.example</groupId> |
| 47 | + <artifactId>customer-openapi</artifactId> |
| 48 | + <version>1.0.0</version> |
| 49 | + <type>jar</type> |
| 50 | +</dependency> |
| 51 | + |
| 52 | +GAV scanning is activated by default. Jar and zip types are supported. The default artifact ID filter is `.\*openapi.*`. To add |
| 53 | +GAV scanning support for JAR and ZIP files, you also need to add each one explicitly in your `application.properties`: |
| 54 | +[source,properties] |
| 55 | +quarkus.openapi-generator.codegen.include-gavs=com.example:customer-openapi |
| 56 | + |
| 57 | +If your specification file is not named `openapi.yaml`, you need to specify the path to the file inside the archive. |
| 58 | +[source,properties] |
| 59 | +quarkus.openapi-generator.codegen.gav.com_example_customer_openapi.spec-files=customer.yaml |
| 60 | + |
| 61 | +==== Note |
| 62 | +- You can also have multiple specification files inside the same archive |
| 63 | +- You can have splitted specifications across multiple files inside the same archive, you need to |
| 64 | +tell the extension the spec-files to use |
| 65 | + |
| 66 | +For more configuration options, refer to the xref:includes/quarkus-openapi-generator.adoc[Configuration Documentation]. |
| 67 | + |
| 68 | + |
0 commit comments