Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix API key cookie authentication (#568) #569

Merged
merged 6 commits into from
Jan 19, 2024
Merged

Fix API key cookie authentication (#568) #569

merged 6 commits into from
Jan 19, 2024

Conversation

ssternal
Copy link
Contributor

Fixes #568:
Replaces access to read-only cookies using mutable headers during API key cookie authentication. This works around a potential UnsupportedOperationException.

Copy link
Contributor

github-actions bot commented Nov 17, 2023

🎊 PR Preview b47f3c2 has been successfully built and deployed. See the documentation preview: https://quarkus-openapi-generator-preview-pr-569.surge.sh

Copy link
Member

@ricardozanini ricardozanini left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Were you able to test in your environment with your example OpenAPI file? Can you use your file to write an IT for this use case?

@ssternal
Copy link
Contributor Author

ssternal commented Nov 24, 2023

I can only work on this on fridays, but yes, my locally published snapshot fixes the issue. I will look into the ITs to see if I can create/adapt one.

Edit:

I can't get the ITs to run locally on my machine, neither using the classic nor the reactive profile. That makes developing an IT a little bit hard. Any hints?

mvn clean verify -P resteasy-classic
[INFO] Error stacktraces are turned on.
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO] 
[INFO] Quarkus - Openapi Generator - Parent                               [pom]
[INFO] Quarkus - Openapi Generator - Runtime                              [jar]
[INFO] Quarkus - Openapi Generator - Test Utils                           [jar]
[INFO] Quarkus - Openapi Generator - Deployment                           [jar]
[INFO] Quarkus - Openapi Generator - Documentation                        [jar]
[INFO] Quarkus - Openapi Generator - Integration Tests                    [pom]
[INFO] Quarkus - Openapi Generator - Integration Tests - Array enum       [jar]
[INFO] Quarkus - Openapi Generator - Integration Tests - BeanParam        [jar]
[INFO] Quarkus - Openapi Generator - Integration Tests - Change directory [jar]
[INFO] Quarkus - Openapi Generator - Integration Tests - Circuit Breaker  [jar]
[INFO] Quarkus - Openapi Generator - Integration Tests - Cookie Authentication [jar]
[INFO] Quarkus - Openapi Generator - Integration Tests - Custom Templates [jar]
[INFO] Quarkus - Openapi Generator - Integration Tests - Enum Property    [jar]
[INFO] Quarkus - Openapi Generator - Integration Tests - Exclude          [jar]
[INFO] Quarkus - Openapi Generator - Integration Tests - Generation Input [jar]
[INFO] Quarkus - Openapi Generator - Integration Tests - Generation Tests [jar]
[INFO] Quarkus - Openapi Generator - Integration Tests - Include          [jar]
[INFO] Quarkus - Openapi Generator - Integration Tests - Multipart Request [jar]
[INFO] Quarkus - Openapi Generator - Integration Tests - Mutiny           [jar]
[INFO] Quarkus - Openapi Generator - Integration Tests - OpenAPI Normalizer [jar]
[INFO] Quarkus - Openapi Generator - Integration Tests - PartFilename     [jar]
[INFO] Quarkus - Openapi Generator - Integration Tests - return-response  [jar]
[INFO] Quarkus - Openapi Generator - Integration Tests - Security         [jar]
[INFO] Quarkus - Openapi Generator - Integration Tests - Simple           [jar]
[INFO] Quarkus - Openapi Generator - Integration Tests - Skip Spec Validation [jar]
[INFO] Quarkus - Openapi Generator - Integration Tests - Suffix / Prefix  [jar]
[INFO] Quarkus - Openapi Generator - Integration Tests - Type Mapping     [jar]
[INFO] Quarkus - Openapi Generator - Integration Tests - Config Key       [jar]
[INFO] Quarkus - Openapi Generator - Integration Tests - GitHub spec      [jar]
[INFO] Quarkus - Openapi Generator - Integration Tests - Additional Properties [jar]
[...]
[INFO] --< io.quarkiverse.openapi.generator:quarkus-openapi-generator-it-array-enum >--
[INFO] Building Quarkus - Openapi Generator - Integration Tests - Array enum 2.2.14-SNAPSHOT [7/30]
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] 
[INFO] --- maven-clean-plugin:3.2.0:clean (default-clean) @ quarkus-openapi-generator-it-array-enum ---
[INFO] Deleting ...\quarkus-openapi-generator\integration-tests\array-enum\target
[INFO] 
[INFO] --- maven-enforcer-plugin:3.3.0:enforce (enforce-java-version) @ quarkus-openapi-generator-it-array-enum ---
[INFO] Skipping Rule Enforcement.
[INFO] 
[INFO] --- maven-enforcer-plugin:3.3.0:enforce (enforce-maven-version) @ quarkus-openapi-generator-it-array-enum ---
[INFO] Skipping Rule Enforcement.
[INFO] 
[INFO] --- buildnumber-maven-plugin:3.2.0:create (get-scm-revision) @ quarkus-openapi-generator-it-array-enum ---
[INFO] 
[INFO] --- formatter-maven-plugin:2.23.0:format (format-sources) @ quarkus-openapi-generator-it-array-enum ---
[INFO] Processed 1 files in 892ms (Formatted: 0, Skipped: 0, Unchanged: 1, Failed: 0, Readonly: 0)
[INFO] 
[INFO] --- impsort-maven-plugin:1.9.0:sort (sort-imports) @ quarkus-openapi-generator-it-array-enum ---
[INFO] Processed 1 files in 00:00.204 (Already Sorted: 1, Needed Sorting: 0)
[INFO] 
[INFO] --- maven-resources-plugin:3.3.1:resources (default-resources) @ quarkus-openapi-generator-it-array-enum ---
[INFO] Copying 1 resource from src\main\resources to target\classes
[INFO] 
[INFO] --- quarkus-maven-plugin:3.5.2:generate-code (default) @ quarkus-openapi-generator-it-array-enum ---
[INFO] Generating with dryRun=false
[INFO] No .openapi-generator-ignore file found.
[INFO] OpenAPI Generator: quarkus (client)
[INFO] Generator 'quarkus' is considered stable.
[INFO] Environment variable JAVA_POST_PROCESS_FILE not defined so the Java code may not be properly formatted. To define it, try 'export JAVA_POST_PROCESS_FILE="/usr/local/bin/clang-format -i"' (Linux/Mac)
[INFO] NOTE: To enable file post-processing, 'enablePostProcessFile' must be set to `true` (--enable-post-process-file for CLI).
[INFO] Processing operation create-a-webhook
[INFO] Processing operation null
[INFO] 'host' (OAS 2.0) or 'servers' (OAS 3.0) not defined in the spec. Default to [http://localhost] for server URL [http://localhost/]
[INFO] 'host' (OAS 2.0) or 'servers' (OAS 3.0) not defined in the spec. Default to [http://localhost] for server URL [http://localhost/]
[INFO] writing file ...\quarkus-openapi-generator\integration-tests\array-enum\target\generated-sources\open-api-yaml\org\openapi\quarkus\array_enum_yaml\model\WebhookCreateUpdatePayload.java
[INFO] Skipped ...\quarkus-openapi-generator\integration-tests\array-enum\target\generated-sources\open-api-yaml\docs\WebhookCreateUpdatePayload.md (Skipped by modelDocs options supplied by user.)
[WARNING] Empty operationId found for path: get /messaging/topics. Renamed to auto-generated operationId: messagingTopicsGet
[INFO] 'host' (OAS 2.0) or 'servers' (OAS 3.0) not defined in the spec. Default to [http://localhost] for server URL [http://localhost/]
[INFO] writing file ...\quarkus-openapi-generator\integration-tests\array-enum\target\generated-sources\open-api-yaml\org\openapi\quarkus\array_enum_yaml\api\ArrayEnumResourceApi.java
[INFO] Skipped ...\quarkus-openapi-generator\integration-tests\array-enum\target\generated-sources\open-api-yaml\org\openapi\quarkus\array_enum_yaml\api\ArrayEnumResourceApiTest.java (Skipped by apiTests options supplied by user.)
[INFO] Skipped ...\quarkus-openapi-generator\integration-tests\array-enum\target\generated-sources\open-api-yaml\docs\ArrayEnumResourceApi.md (Skipped by apiDocs options supplied by user.)
[INFO] 'host' (OAS 2.0) or 'servers' (OAS 3.0) not defined in the spec. Default to [http://localhost] for server URL [http://localhost/]
[INFO] writing file ...\quarkus-openapi-generator\integration-tests\array-enum\target\generated-sources\open-api-yaml\org\openapi\quarkus\array_enum_yaml\api\QuarkusTopicsInformationResourceApi.java
[INFO] Skipped ...\quarkus-openapi-generator\integration-tests\array-enum\target\generated-sources\open-api-yaml\org\openapi\quarkus\array_enum_yaml\api\QuarkusTopicsInformationResourceApiTest.java (Skipped by apiTests options supplied by user.)
[INFO] Skipped ...\quarkus-openapi-generator\integration-tests\array-enum\target\generated-sources\open-api-yaml\docs\QuarkusTopicsInformationResourceApi.md (Skipped by apiDocs options supplied by user.)
[INFO] 'host' (OAS 2.0) or 'servers' (OAS 3.0) not defined in the spec. Default to [http://localhost] for server URL [http://localhost/]
[INFO] writing file ...\quarkus-openapi-generator\integration-tests\array-enum\target\generated-sources\open-api-yaml\.openapi-generator-ignore
[INFO] writing file ...\quarkus-openapi-generator\integration-tests\array-enum\target\generated-sources\open-api-yaml\.openapi-generator\VERSION
[INFO] writing file ...\quarkus-openapi-generator\integration-tests\array-enum\target\generated-sources\open-api-yaml\.openapi-generator\FILES
[INFO] 
[INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) @ quarkus-openapi-generator-it-array-enum ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 3 source files to ...\quarkus-openapi-generator\integration-tests\array-enum\target\classes
[INFO] 
[INFO] --- quarkus-maven-plugin:3.5.2:generate-code-tests (default) @ quarkus-openapi-generator-it-array-enum ---
[INFO] 
[INFO] --- maven-resources-plugin:3.3.1:testResources (default-testResources) @ quarkus-openapi-generator-it-array-enum ---
[INFO] skip non existing resourceDirectory ...\quarkus-openapi-generator\integration-tests\array-enum\src\test\resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.8.1:testCompile (default-testCompile) @ quarkus-openapi-generator-it-array-enum ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 1 source file to ...\quarkus-openapi-generator\integration-tests\array-enum\target\test-classes
[INFO] 
[INFO] --- maven-surefire-plugin:3.1.2:test (default-test) @ quarkus-openapi-generator-it-array-enum ---
[INFO] Surefire report directory: ...\quarkus-openapi-generator\integration-tests\array-enum\target\surefire-reports
[INFO] Using auto detected provider org.apache.maven.surefire.junitplatform.JUnitPlatformProvider
[INFO] 
[INFO] -------------------------------------------------------
[INFO]  T E S T S
[INFO] -------------------------------------------------------
[INFO] Running io.quarkiverse.openapi.generator.it.ArrayEnumTest
[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 9.337 s <<< FAILURE! -- in io.quarkiverse.openapi.generator.it.ArrayEnumTest
[ERROR] io.quarkiverse.openapi.generator.it.ArrayEnumTest.apiIsBeingGenerated -- Time elapsed: 0.047 s <<< ERROR!
java.lang.RuntimeException: 
java.lang.RuntimeException: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
	[error]: Build step io.quarkus.arc.deployment.ArcProcessor#validate threw an exception: jakarta.enterprise.inject.spi.DeploymentException: jakarta.enterprise.inject.UnsatisfiedResolutionException: Unsatisfied dependency for type org.openapi.quarkus.array_enum_yaml.api.ArrayEnumResourceApi and qualifiers [@Default]
	- java member: io.quarkiverse.openapi.generator.it.ArrayEnumTest#api
	- declared on CLASS bean [types=[io.quarkiverse.openapi.generator.it.ArrayEnumTest, java.lang.Object], qualifiers=[@Default, @Any], target=io.quarkiverse.openapi.generator.it.ArrayEnumTest]
	at io.quarkus.arc.processor.BeanDeployment.processErrors(BeanDeployment.java:1447)
	at io.quarkus.arc.processor.BeanDeployment.init(BeanDeployment.java:311)
	at io.quarkus.arc.processor.BeanProcessor.initialize(BeanProcessor.java:158)
	at io.quarkus.arc.deployment.ArcProcessor.validate(ArcProcessor.java:471)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at io.quarkus.deployment.ExtensionLoader$3.execute(ExtensionLoader.java:849)
	at io.quarkus.builder.BuildContext.run(BuildContext.java:282)
	at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
	at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2513)
	at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1538)
	at java.base/java.lang.Thread.run(Thread.java:829)
	at org.jboss.threads.JBossThread.run(JBossThread.java:501)
Caused by: jakarta.enterprise.inject.UnsatisfiedResolutionException: Unsatisfied dependency for type org.openapi.quarkus.array_enum_yaml.api.ArrayEnumResourceApi and qualifiers [@Default]
	- java member: io.quarkiverse.openapi.generator.it.ArrayEnumTest#api
	- declared on CLASS bean [types=[io.quarkiverse.openapi.generator.it.ArrayEnumTest, java.lang.Object], qualifiers=[@Default, @Any], target=io.quarkiverse.openapi.generator.it.ArrayEnumTest]
	at io.quarkus.arc.processor.Beans.resolveInjectionPoint(Beans.java:478)
	at io.quarkus.arc.processor.BeanInfo.init(BeanInfo.java:624)
	at io.quarkus.arc.processor.BeanDeployment.init(BeanDeployment.java:299)
	... 13 more

	at io.quarkus.test.junit.QuarkusTestExtension.throwBootFailureException(QuarkusTestExtension.java:639)
	at io.quarkus.test.junit.QuarkusTestExtension.interceptTestClassConstructor(QuarkusTestExtension.java:723)
	at java.base/java.util.Optional.orElseGet(Optional.java:369)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1541)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1541)
Caused by: java.lang.RuntimeException: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
	[error]: Build step io.quarkus.arc.deployment.ArcProcessor#validate threw an exception: jakarta.enterprise.inject.spi.DeploymentException: jakarta.enterprise.inject.UnsatisfiedResolutionException: Unsatisfied dependency for type org.openapi.quarkus.array_enum_yaml.api.ArrayEnumResourceApi and qualifiers [@Default]
	- java member: io.quarkiverse.openapi.generator.it.ArrayEnumTest#api
	- declared on CLASS bean [types=[io.quarkiverse.openapi.generator.it.ArrayEnumTest, java.lang.Object], qualifiers=[@Default, @Any], target=io.quarkiverse.openapi.generator.it.ArrayEnumTest]
	at io.quarkus.arc.processor.BeanDeployment.processErrors(BeanDeployment.java:1447)
	at io.quarkus.arc.processor.BeanDeployment.init(BeanDeployment.java:311)
	at io.quarkus.arc.processor.BeanProcessor.initialize(BeanProcessor.java:158)
	at io.quarkus.arc.deployment.ArcProcessor.validate(ArcProcessor.java:471)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at io.quarkus.deployment.ExtensionLoader$3.execute(ExtensionLoader.java:849)
	at io.quarkus.builder.BuildContext.run(BuildContext.java:282)
	at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
	at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2513)
	at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1538)
	at java.base/java.lang.Thread.run(Thread.java:829)
	at org.jboss.threads.JBossThread.run(JBossThread.java:501)
Caused by: jakarta.enterprise.inject.UnsatisfiedResolutionException: Unsatisfied dependency for type org.openapi.quarkus.array_enum_yaml.api.ArrayEnumResourceApi and qualifiers [@Default]
	- java member: io.quarkiverse.openapi.generator.it.ArrayEnumTest#api
	- declared on CLASS bean [types=[io.quarkiverse.openapi.generator.it.ArrayEnumTest, java.lang.Object], qualifiers=[@Default, @Any], target=io.quarkiverse.openapi.generator.it.ArrayEnumTest]
	at io.quarkus.arc.processor.Beans.resolveInjectionPoint(Beans.java:478)
	at io.quarkus.arc.processor.BeanInfo.init(BeanInfo.java:624)
	at io.quarkus.arc.processor.BeanDeployment.init(BeanDeployment.java:299)
	... 13 more

	at io.quarkus.runner.bootstrap.AugmentActionImpl.runAugment(AugmentActionImpl.java:336)
	at io.quarkus.runner.bootstrap.AugmentActionImpl.createInitialRuntimeApplication(AugmentActionImpl.java:253)
	at io.quarkus.runner.bootstrap.AugmentActionImpl.createInitialRuntimeApplication(AugmentActionImpl.java:60)
	at io.quarkus.test.junit.QuarkusTestExtension.doJavaStart(QuarkusTestExtension.java:223)
	at io.quarkus.test.junit.QuarkusTestExtension.ensureStarted(QuarkusTestExtension.java:606)
	at io.quarkus.test.junit.QuarkusTestExtension.beforeAll(QuarkusTestExtension.java:656)
	... 1 more
Caused by: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
	[error]: Build step io.quarkus.arc.deployment.ArcProcessor#validate threw an exception: jakarta.enterprise.inject.spi.DeploymentException: jakarta.enterprise.inject.UnsatisfiedResolutionException: Unsatisfied dependency for type org.openapi.quarkus.array_enum_yaml.api.ArrayEnumResourceApi and qualifiers [@Default]
	- java member: io.quarkiverse.openapi.generator.it.ArrayEnumTest#api
	- declared on CLASS bean [types=[io.quarkiverse.openapi.generator.it.ArrayEnumTest, java.lang.Object], qualifiers=[@Default, @Any], target=io.quarkiverse.openapi.generator.it.ArrayEnumTest]
	at io.quarkus.arc.processor.BeanDeployment.processErrors(BeanDeployment.java:1447)
	at io.quarkus.arc.processor.BeanDeployment.init(BeanDeployment.java:311)
	at io.quarkus.arc.processor.BeanProcessor.initialize(BeanProcessor.java:158)
	at io.quarkus.arc.deployment.ArcProcessor.validate(ArcProcessor.java:471)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at io.quarkus.deployment.ExtensionLoader$3.execute(ExtensionLoader.java:849)
	at io.quarkus.builder.BuildContext.run(BuildContext.java:282)
	at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
	at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2513)
	at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1538)
	at java.base/java.lang.Thread.run(Thread.java:829)
	at org.jboss.threads.JBossThread.run(JBossThread.java:501)
Caused by: jakarta.enterprise.inject.UnsatisfiedResolutionException: Unsatisfied dependency for type org.openapi.quarkus.array_enum_yaml.api.ArrayEnumResourceApi and qualifiers [@Default]
	- java member: io.quarkiverse.openapi.generator.it.ArrayEnumTest#api
	- declared on CLASS bean [types=[io.quarkiverse.openapi.generator.it.ArrayEnumTest, java.lang.Object], qualifiers=[@Default, @Any], target=io.quarkiverse.openapi.generator.it.ArrayEnumTest]
	at io.quarkus.arc.processor.Beans.resolveInjectionPoint(Beans.java:478)
	at io.quarkus.arc.processor.BeanInfo.init(BeanInfo.java:624)
	at io.quarkus.arc.processor.BeanDeployment.init(BeanDeployment.java:299)
	... 13 more

	at io.quarkus.builder.Execution.run(Execution.java:123)
	at io.quarkus.builder.BuildExecutionBuilder.execute(BuildExecutionBuilder.java:79)
	at io.quarkus.deployment.QuarkusAugmentor.run(QuarkusAugmentor.java:160)
	at io.quarkus.runner.bootstrap.AugmentActionImpl.runAugment(AugmentActionImpl.java:332)
	... 6 more
Caused by: jakarta.enterprise.inject.spi.DeploymentException: jakarta.enterprise.inject.UnsatisfiedResolutionException: Unsatisfied dependency for type org.openapi.quarkus.array_enum_yaml.api.ArrayEnumResourceApi and qualifiers [@Default]
	- java member: io.quarkiverse.openapi.generator.it.ArrayEnumTest#api
	- declared on CLASS bean [types=[io.quarkiverse.openapi.generator.it.ArrayEnumTest, java.lang.Object], qualifiers=[@Default, @Any], target=io.quarkiverse.openapi.generator.it.ArrayEnumTest]
	at io.quarkus.arc.processor.BeanDeployment.processErrors(BeanDeployment.java:1447)
	at io.quarkus.arc.processor.BeanDeployment.init(BeanDeployment.java:311)
	at io.quarkus.arc.processor.BeanProcessor.initialize(BeanProcessor.java:158)
	at io.quarkus.arc.deployment.ArcProcessor.validate(ArcProcessor.java:471)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at io.quarkus.deployment.ExtensionLoader$3.execute(ExtensionLoader.java:849)
	at io.quarkus.builder.BuildContext.run(BuildContext.java:282)
	at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
	at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2513)
	at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1538)
	at java.base/java.lang.Thread.run(Thread.java:829)
	at org.jboss.threads.JBossThread.run(JBossThread.java:501)
Caused by: jakarta.enterprise.inject.UnsatisfiedResolutionException: Unsatisfied dependency for type org.openapi.quarkus.array_enum_yaml.api.ArrayEnumResourceApi and qualifiers [@Default]
	- java member: io.quarkiverse.openapi.generator.it.ArrayEnumTest#api
	- declared on CLASS bean [types=[io.quarkiverse.openapi.generator.it.ArrayEnumTest, java.lang.Object], qualifiers=[@Default, @Any], target=io.quarkiverse.openapi.generator.it.ArrayEnumTest]
	at io.quarkus.arc.processor.Beans.resolveInjectionPoint(Beans.java:478)
	at io.quarkus.arc.processor.BeanInfo.init(BeanInfo.java:624)
	at io.quarkus.arc.processor.BeanDeployment.init(BeanDeployment.java:299)
	... 10 more

[INFO] 
[INFO] Results:
[INFO] 
[ERROR] Errors: 
[ERROR]   ArrayEnumTest.apiIsBeingGenerated » Runtime java.lang.RuntimeException: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
	[error]: Build step io.quarkus.arc.deployment.ArcProcessor#validate threw an exception: jakarta.enterprise.inject.spi.DeploymentException: jakarta.enterprise.inject.UnsatisfiedResolutionException: Unsatisfied dependency for type org.openapi.quarkus.array_enum_yaml.api.ArrayEnumResourceApi and qualifiers [@Default]
	- java member: io.quarkiverse.openapi.generator.it.ArrayEnumTest#api
	- declared on CLASS bean [types=[io.quarkiverse.openapi.generator.it.ArrayEnumTest, java.lang.Object], qualifiers=[@Default, @Any], target=io.quarkiverse.openapi.generator.it.ArrayEnumTest]
	at io.quarkus.arc.processor.BeanDeployment.processErrors(BeanDeployment.java:1447)
	at io.quarkus.arc.processor.BeanDeployment.init(BeanDeployment.java:311)
	at io.quarkus.arc.processor.BeanProcessor.initialize(BeanProcessor.java:158)
	at io.quarkus.arc.deployment.ArcProcessor.validate(ArcProcessor.java:471)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at io.quarkus.deployment.ExtensionLoader$3.execute(ExtensionLoader.java:849)
	at io.quarkus.builder.BuildContext.run(BuildContext.java:282)
	at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
	at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2513)
	at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1538)
	at java.base/java.lang.Thread.run(Thread.java:829)
	at org.jboss.threads.JBossThread.run(JBossThread.java:501)
Caused by: jakarta.enterprise.inject.UnsatisfiedResolutionException: Unsatisfied dependency for type org.openapi.quarkus.array_enum_yaml.api.ArrayEnumResourceApi and qualifiers [@Default]
	- java member: io.quarkiverse.openapi.generator.it.ArrayEnumTest#api
	- declared on CLASS bean [types=[io.quarkiverse.openapi.generator.it.ArrayEnumTest, java.lang.Object], qualifiers=[@Default, @Any], target=io.quarkiverse.openapi.generator.it.ArrayEnumTest]
	at io.quarkus.arc.processor.Beans.resolveInjectionPoint(Beans.java:478)
	at io.quarkus.arc.processor.BeanInfo.init(BeanInfo.java:624)
	at io.quarkus.arc.processor.BeanDeployment.init(BeanDeployment.java:299)
	... 13 more

[INFO] 
[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0
[INFO] 
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary for Quarkus - Openapi Generator - Parent 2.2.14-SNAPSHOT:
[INFO] 
[INFO] Quarkus - Openapi Generator - Parent ............... SUCCESS [  1.996 s]
[INFO] Quarkus - Openapi Generator - Runtime .............. SUCCESS [ 18.443 s]
[INFO] Quarkus - Openapi Generator - Test Utils ........... SUCCESS [  1.573 s]
[INFO] Quarkus - Openapi Generator - Deployment ........... SUCCESS [ 15.317 s]
[INFO] Quarkus - Openapi Generator - Documentation ........ SUCCESS [ 10.230 s]
[INFO] Quarkus - Openapi Generator - Integration Tests .... SUCCESS [  0.250 s]
[INFO] Quarkus - Openapi Generator - Integration Tests - Array enum FAILURE [ 23.503 s]
[INFO] Quarkus - Openapi Generator - Integration Tests - BeanParam SKIPPED
[INFO] Quarkus - Openapi Generator - Integration Tests - Change directory SKIPPED
[INFO] Quarkus - Openapi Generator - Integration Tests - Circuit Breaker SKIPPED
[INFO] Quarkus - Openapi Generator - Integration Tests - Cookie Authentication SKIPPED
[INFO] Quarkus - Openapi Generator - Integration Tests - Custom Templates SKIPPED
[INFO] Quarkus - Openapi Generator - Integration Tests - Enum Property SKIPPED
[INFO] Quarkus - Openapi Generator - Integration Tests - Exclude SKIPPED
[INFO] Quarkus - Openapi Generator - Integration Tests - Generation Input SKIPPED
[INFO] Quarkus - Openapi Generator - Integration Tests - Generation Tests SKIPPED
[INFO] Quarkus - Openapi Generator - Integration Tests - Include SKIPPED
[INFO] Quarkus - Openapi Generator - Integration Tests - Multipart Request SKIPPED
[INFO] Quarkus - Openapi Generator - Integration Tests - Mutiny SKIPPED
[INFO] Quarkus - Openapi Generator - Integration Tests - OpenAPI Normalizer SKIPPED
[INFO] Quarkus - Openapi Generator - Integration Tests - PartFilename SKIPPED
[INFO] Quarkus - Openapi Generator - Integration Tests - return-response SKIPPED
[INFO] Quarkus - Openapi Generator - Integration Tests - Security SKIPPED
[INFO] Quarkus - Openapi Generator - Integration Tests - Simple SKIPPED
[INFO] Quarkus - Openapi Generator - Integration Tests - Skip Spec Validation SKIPPED
[INFO] Quarkus - Openapi Generator - Integration Tests - Suffix / Prefix SKIPPED
[INFO] Quarkus - Openapi Generator - Integration Tests - Type Mapping SKIPPED
[INFO] Quarkus - Openapi Generator - Integration Tests - Config Key SKIPPED
[INFO] Quarkus - Openapi Generator - Integration Tests - GitHub spec SKIPPED
[INFO] Quarkus - Openapi Generator - Integration Tests - Additional Properties SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  01:14 min
[INFO] Finished at: 2023-11-24T11:11:05+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:3.1.2:test (default-test) on project quarkus-openapi-generator-it-array-enum: 
[ERROR] 
[ERROR] Please refer to ...\quarkus-openapi-generator\integration-tests\array-enum\target\surefire-reports for the individual test results.
[ERROR] Please refer to dump files (if any exist) [date].dump, [date]-jvmRun[N].dump and [date].dumpstream.
[ERROR] -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:3.1.2:test (default-test) on project quarkus-openapi-generator-it-array-enum: 
[...]

Process finished with exit code 1

@ricardozanini
Copy link
Member

Can you investigate this generated file?

Unsatisfied dependency for type org.openapi.quarkus.array_enum_yaml.api.ArrayEnumResourceApi

@ssternal
Copy link
Contributor Author

ssternal commented Dec 1, 2023

I have checked the generated file and everything looks fine. Therefore, I decided to have a look at the dependency injection. While reading the Quarkus DI guide I discovered the option to prevent ArC from removing configured beans. After adding the following line to my local application config, I was able to run the tests:

quarkus.arc.unremovable-types=org.eclipse.*

I have no idea why the rest client is removed per default on my local test setup, as it works fine whtin the GitHub pipeline. However, with this little hack I could verify my test works out by having a failure without the fix and a success with the fix.

Copy link
Contributor

@hbelmiro hbelmiro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ssternal you need to add the cookie-authentication module to its parent module so the tests can run.

@ssternal
Copy link
Contributor Author

The automated build failed due to an error with the new integration test. The issue arises due to availability of two REST implementations (classic v/s reactive). This again is because of the default activated classic maven profile. During the development of the integration test I asked myself if the classic profile should be acivated per default. Since the integration tests are designed to explicitly activate it when invoking the classic integraion tests I would recommend disabling the default behavior.

@hbelmiro
Copy link
Contributor

@ssternal we need to run tests with RESTEasy Classic and Reactive, unless in rare situations. PTAL at https://github.com/quarkiverse/quarkus-openapi-generator/blob/main/CONTRIBUTING.md#resteasy-reactive-and-resteasy-classic.

To fix the failing tests you need to remove the dependencies from the test pom.xml. Those dependencies are handled by the parent module. You can use https://github.com/quarkiverse/quarkus-openapi-generator/blob/main/integration-tests/simple/pom.xml as an example.

Co-authored-by: nmirasch <neus.miras@gmail.com>
Co-authored-by: nmirasch <neus.miras@gmail.com>
@hbelmiro hbelmiro merged commit ed66066 into quarkiverse:main Jan 19, 2024
11 checks passed
@hbelmiro
Copy link
Contributor

@all-contributors add @nmirasch for code.

Copy link
Contributor

@hbelmiro

I've put up a pull request to add @nmirasch! 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ApiKey/Cookie authentication issue
5 participants