quarkus.smallrye-openapi does not support SecurityScheme of type apiKey #33159
Labels
area/openapi
area/security
area/smallrye
env/windows
Impacts Windows machines
kind/bug
Something isn't working
Milestone
Describe the bug
For an integration with AWS API Gateway I'd like to configure the required values for the openapi.yaml respectively openapi.json as described by AWS. This requires type "apiKey" which is specified for OpenAPI 3.0.3 (see OpenAPI 3.0.3 specification)
However, when I use the property quarkus.smallrye-openapi.security-scheme, it does not support apiKey.
Therefore, I use microprofile annotations, for configuring the SecurityScheme:
This works quite good, and produces the following openapi.yaml
The problem here is: There is an additional security scheme with the default name "SecurityScheme" and the default scheme "basic" added.
I could not find a way how to suppress the generation of the default scheme "SecurityScheme"
Expected behavior
quarkus.smallrye-openapi.security-scheme should support type "apiKey" as specified in OpenAPI 3.0.3 specification
AND
When using the Annotation org.eclipse.microprofile.openapi.annotations.security.SecurityScheme no default security scheme "SecurityScheme" should be generated in the openapi.yaml
Actual behavior
With the properties (using config-yaml extension) like this:
the build fails:
[ERROR] Failed to execute goal io.quarkus.platform:quarkus-maven-plugin:3.0.2.Final:build (default) on project openapi-issue: Failed to build quarkus application: SRCFG00039: The config property quarkus.smallrye-openapi.security-scheme with the config value "apiKey" threw an Exception whilst being converted Cannot convert apiKey to enum class io.quarkus.smallrye.openapi.common.deployment.SmallRyeOpenApiConfig$SecurityScheme -> [Help 1]
With the workaround (as described above) an unwanted default security scheme is created
How to Reproduce?
Problem 1 (apiKey not supported)
Build (mvn package -DskipTests) will fail
Problem 2 (additional unwanted default security scheme):
Class Constants.java:
Result: openapi.yaml created with additional security scheme
openapi-issue.tar.gz
Output of
uname -a
orver
Linux HOSTNAME 5.4.0-148-generic #165-Ubuntu SMP Tue Apr 18 08:53:12 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
Output of
java -version
openjdk version "17.0.6" 2023-01-17
GraalVM version (if different from Java)
No response
Quarkus version or git rev
3.0.2.Final
Build tool (ie. output of
mvnw --version
orgradlew --version
)Apache Maven 3.8.8
Additional information
Same behavior with Quarkus 2.16.6.Final and Java 11 in Windows 10
The text was updated successfully, but these errors were encountered: