You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+33-17Lines changed: 33 additions & 17 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -100,12 +100,17 @@ See the [integration-tests](integration-tests) module for more information of ho
100
100
101
101
## Authentication Support
102
102
103
-
If your OpenAPI specification file has `securitySchemes`[definitions](https://spec.openapis.org/oas/v3.1.0#security-scheme-object), the inner generator will [register `ClientRequestFilter`s providers](https://download.eclipse.org/microprofile/microprofile-rest-client-2.0/microprofile-rest-client-spec-2.0.html#_provider_declaration) for you to implement the given authentication mechanism.
103
+
If your OpenAPI specification file has `securitySchemes`[definitions](https://spec.openapis.org/oas/v3.1.0#security-scheme-object), the inner generator
104
+
will [register `ClientRequestFilter`s providers](https://download.eclipse.org/microprofile/microprofile-rest-client-2.0/microprofile-rest-client-spec-2.0.html#_provider_declaration) for you to
105
+
implement the given authentication mechanism.
104
106
105
-
To provide the credentials for your application, you can use the [Quarkus configuration support](https://quarkus.io/guides/config). The configuration key is composed using this pattern: `[base_package].security.auth.[security_scheme_name]/[auth_property_name]`. Where:
107
+
To provide the credentials for your application, you can use the [Quarkus configuration support](https://quarkus.io/guides/config). The configuration key is composed using this
-`base_package` is the package name you gave when configuring the code generation using `quarkus.openapi-generator.codegen.spec.[open_api_file].base-package` property.
108
-
-`security_scheme_name` is the name of the [security scheme object definition](https://spec.openapis.org/oas/v3.1.0#security-scheme-object) in the OpenAPI file. Given the following excerpt, we have `api_key` and `basic_auth` security schemes:
111
+
-`security_scheme_name` is the name of the [security scheme object definition](https://spec.openapis.org/oas/v3.1.0#security-scheme-object) in the OpenAPI file. Given the following excerpt, we
112
+
have `api_key` and `basic_auth` security schemes:
113
+
109
114
```json
110
115
{
111
116
"securitySchemes": {
@@ -121,6 +126,7 @@ To provide the credentials for your application, you can use the [Quarkus config
121
126
}
122
127
}
123
128
```
129
+
124
130
-`auth_property_name` varies depending on the authentication provider. For example, for Basic Authentication we have `username` and `password`. See the following sections for more details.
125
131
126
132
> Tip: on production environments you will likely to use [HashiCorp Vault](https://quarkiverse.github.io/quarkiverse-docs/quarkus-vault/dev/index.html) or [Kubernetes Secrets](https://kubernetes.io/docs/concepts/configuration/secret/) to provide this information for your application.
@@ -150,14 +156,15 @@ Similarly to bearer token, the API Key Authentication also has the token entry k
| API Key |`[base_package].security.auth.[security_scheme_name]/api-key`|`org.acme.openapi.security.auth.apikey/api-key`|
152
158
153
-
The API Key scheme has an additional property that requires where to add the API key in the request token: header, cookie or query. The inner provider takes care of that for you.
159
+
The API Key scheme has an additional property that requires where to add the API key in the request token: header, cookie or query. The inner provider takes care of that for you.
154
160
155
161
## Circuit Breaker
156
162
157
163
You can define the [CircuitBreaker annotation from MicroProfile Fault Tolerance](https://microprofile.io/project/eclipse/microprofile-fault-tolerance/spec/src/main/asciidoc/circuitbreaker.asciidoc)
158
164
in your generated classes by setting the desired configuration in `application.properties`.
159
165
160
166
Let's say you have the following OpenAPI definition:
167
+
161
168
````json
162
169
{
163
170
"openapi": "3.0.3",
@@ -207,17 +214,17 @@ And you want to configure Circuit Breaker for the `/bye` endpoint, you can do it
207
214
Add the [SmallRye Fault Tolerance extension](https://quarkus.io/guides/smallrye-fault-tolerance) to your project's `pom.xml` file:
You can also override the default Circuit Breaker configuration by setting the properties in `application.properties`[just as you would for a traditional MicroProfile application](https://quarkus.io/guides/smallrye-fault-tolerance#runtime-configuration):
266
+
You can also override the default Circuit Breaker configuration by setting the properties
267
+
in `application.properties`[just as you would for a traditional MicroProfile application](https://quarkus.io/guides/smallrye-fault-tolerance#runtime-configuration):
Having the files in the `src/main/openapi` directory will generate the REST stubs by default. Alternatively, you can implement the `io.quarkiverse.openapi.generator.codegen.OpenApiSpecInputProvider`
282
+
interface to provide a list of `InputStream`s of OpenAPI specification files. This is useful in scenarios where you want to dynamically generate the client code without having the target spec file
283
+
saved locally in your project.
284
+
285
+
See the example implementation [here](test-utils/src/main/java/io/quarkiverse/openapi/generator/testutils/codegen/ClassPathPetstoreOpenApiSpecInputProvider.java)
Copy file name to clipboardExpand all lines: deployment/src/main/java/io/quarkiverse/openapi/generator/deployment/codegen/OpenApiGeneratorCodeGenBase.java
0 commit comments