forked from quarkiverse/quarkus-openapi-generator
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change base directory + add include property (quarkiverse#179)
* Change base directory + add include property * Changes from PR * Changes from PR * Changes from PR * Generalize baseModuleDirectory path * format code * Make shouldRun throw an exception when the path is invalid * Revert "Make shouldRun throw an exception when the path is invalid" This reverts commit c083139. Co-authored-by: Gwydion Martin <[email protected]>
- Loading branch information
Showing
21 changed files
with
877 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -53,10 +53,16 @@ You probably already have this configuration if you created your application wit | |
|
||
Now, create the directory `openapi` under your `src/main/` path and add the OpenAPI spec files there. We support JSON, YAML and YML extensions. | ||
|
||
If you want to change the directory where OpenAPI files must be found, use the property `quarkus.openapi-generator.codegen.input-base-dir`. | ||
IMPORTANT: it is relative to the project base directory. For example, if you have a project called `MyJavaProject` and decide to place them in `MyJavaProject/openapi-definitions`, use the following property: | ||
|
||
```properties | ||
quarkus.openapi-generator.codegen.input-base-dir=openapi-definitions | ||
``` | ||
|
||
To fine tune the configuration for each spec file, add the following entry to your properties file. In this example, our spec file is in `src/main/openapi/petstore.json`: | ||
|
||
```properties | ||
quarkus.openapi-generator.codegen.spec.petstore_json.base-package=org.acme.openapi | ||
quarkus.openapi-generator.codegen.spec.petstore_json.additional-model-type-annotations[email protected];@org.test.Bar | ||
``` | ||
|
||
|
@@ -120,16 +126,25 @@ Since the most part of this extension work is in the `generate-code` execution p | |
|
||
For more information, see the [Maven Logging Configuration](https://maven.apache.org/maven-logging.html) guide. | ||
|
||
## Ignoring OpenAPI Specification Files | ||
## Filtering OpenAPI Specification Files | ||
|
||
To ignore code generation for specific OpenAPI specification files, you can set the `quarkus.openapi-generator.codegen.ignore` property. | ||
By default, the extension will process every OpenAPI specification file in the given path. | ||
To limit code generation to only a specific set of OpenAPI specification files, you can set the `quarkus.openapi-generator.codegen.include` property. | ||
For instance, if you want to limit code generation for `include-openapi.yaml` and `include-openapi-2.yaml` files, you need to define the property like: | ||
|
||
For instance, if you want to ignore code generation for `ignored-openapi.yaml` and `ignored-openapi-2.yaml` files, you need to define the `quarkus.openapi-generator.codegen.ignore` property like the following: | ||
```properties | ||
quarkus.openapi-generator.codegen.include=include-openapi.yaml,include-openapi-2.yaml | ||
``` | ||
|
||
If you prefer to specify which files you want to skip, you can set the `quarkus.openapi-generator.codegen.exclude` property. | ||
For instance, if you want to skip code generation for `exclude-openapi.yaml` and `exclude-openapi-2.yaml` files, you need to define the property like: | ||
|
||
```properties | ||
quarkus.openapi-generator.codegen.ignore=ignored-openapi.yaml,ignored-openapi-2.yaml | ||
quarkus.openapi-generator.codegen.exclude=exclude-openapi.yaml,exclude-openapi-2.yaml | ||
``` | ||
|
||
IMPORTANT: `exclude` supersedes `include`, meaning that if a file is in both property it will NOT be analysed. | ||
|
||
See the module [ignore](integration-tests/ignore) for an example of how to use this feature. | ||
|
||
## Authentication Support | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.