quarkiverse / quarkus-openapi-generator

OpenAPI Generator - REST Client Generator
Apache License 2.0
111 stars 76 forks source link

OpenAPI parsing issues #460

Closed eloycoto closed 12 months ago

eloycoto commented 1 year ago

Hi,

Checking some OpenAPI spec parser in https://github.com/kiegroup/kogito-runtimes, I was unable to use some Openapi schemas:

Move2Kube:

https://github.com/konveyor/move2kube-api/blob/main/assets/openapi.json

Errors:

[ERROR] Failed to execute goal io.quarkus.platform:quarkus-maven-plugin:2.16.9.Final:dev (default-cli) on project basic-functions: Unable to execute mojo: Compilation failure:
[ERROR] /home/eloy/dev/upstream/parados/serverless-workflow-examples/basic-functions/target/generated-sources/open-api-stream/org/kie/kogito/openapi/openapi/model/Workspace.java:[46,44] cannot find symbol
[ERROR]   symbol:   class NOT_FOUND
[ERROR]   location: class org.kie.kogito.openapi.openapi.model.Workspace
[ERROR] /home/eloy/dev/upstream/parados/serverless-workflow-examples/basic-functions/target/generated-sources/open-api-stream/org/kie/kogito/openapi/openapi/model/Project.java:[46,42] cannot find symbol
[ERROR]   symbol:   class NOT_FOUND
[ERROR]   location: class org.kie.kogito.openapi.openapi.model.Project
[ERROR] /home/eloy/dev/upstream/parados/serverless-workflow-examples/basic-functions/target/generated-sources/open-api-stream/org/kie/kogito/openapi/openapi/model/Role.java:[39,39] cannot find symbol
[ERROR]   symbol:   class NOT_FOUND
[ERROR]   location: class org.kie.kogito.openapi.openapi.model.Role
[ERROR] -> [Help 1]

Github API:

https://raw.githubusercontent.com/github/rest-api-description/main/descriptions/ghes-3.10/ghes-3.10.json

And the error message:

[ERROR] /home/eloy/dev/upstream/parados/serverless-workflow-examples/basic-functions/target/generated-sources/open-api-stream/org/kie/kogito/openapi/openapi/model/NullableIntegration.java:[64,47] illegal start of expression
[ERROR] /home/eloy/dev/upstream/parados/serverless-workflow-examples/basic-functions/target/generated-sources/open-api-stream/org/kie/kogito/openapi/openapi/model/Integration.java:[64,47] illegal start of expression

The generated code looks like this:

/**
  * GitHub apps are a new way to extend GitHub. They can be installed directly on organizations and user accounts and granted access to specific repositories. They come with granular permissions and built-in webhooks. GitHub apps are first class actors within GitHub.
 **/
private Map<String, String> permissions = ;
eloycoto commented 1 year ago

With Gitlab also failing:

Caused by: org.kie.memorycompiler.KieMemoryCompilerException: [org/kie/kogito/app/Gitlab_putApiV4ProjectsIdAlertManagementAlertsAlertIidMetricImagesMetricImageId.java (9:155) : cannot find symbol
  symbol:   class AlertManagementApi$PutApiV4ProjectsIdAlertManagementAlertsAlertIidMetricImagesMetricImageIdMultipartForm
  location: package org.kie.kogito.openapi.gitlab.api, org/kie/kogito/app/Gitlab_postApiV4ProjectsIdAlertManagementAlertsAlertIidMetricImages.java (9:143) : cannot find symbol
  symbol:   class AlertManagementApi$PostApiV4ProjectsIdAlertManagementAlertsAlertIidMetricImagesMultipartForm
  location: package org.kie.kogito.openapi.gitlab.api, org/kie/kogito/app/Gitlab_putApiV4ApplicationAppearance.java (9:112) : cannot find symbol
  symbol:   class ApplicationApi$PutApiV4ApplicationAppearanceMultipartForm
  location: package org.kie.kogito.openapi.gitlab.api, org/kie/kogito/app/Gitlab_postApiV4BulkImports.java (9:103) : cannot find symbol
  symbol:   class BulkImportsApi$PostApiV4BulkImportsMultipartForm
  location: package org.kie.kogito.openapi.gitlab.api]
        at org.kie.memorycompiler.KieMemoryCompiler.compileNoLoad(KieMemoryCompiler.java:137)
        at org.kie.memorycompiler.KieMemoryCompiler.compileNoLoad(KieMemoryCompiler.java:105)
        at org.drools.drl.quarkus.util.deployment.DroolsQuarkusResourceUtils.compileGeneratedSources(DroolsQuarkusResourceUtils.java:155)
        at org.kie.kogito.quarkus.common.deployment.KogitoAssetsProcessor.createGeneratedBeanBuildItemsFromJavaSources(KogitoAssetsProcessor.java:270)
        at org.kie.kogito.quarkus.common.deployment.KogitoAssetsProcessor.generateModel(KogitoAssetsProcessor.java:179)
        at jdk.internal.reflect.GeneratedMethodAccessor861.invoke(Unknown Source)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:568)
        at io.quarkus.deployment.ExtensionLoader$3.execute(ExtensionLoader.java:909)
        at io.quarkus.builder.BuildContext.run(BuildContext.java:281)
        at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
        at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2449)
        at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1478)
        at java.base/java.lang.Thread.run(Thread.java:833)
        at org.jboss.threads.JBossThread.run(JBossThread.java:501)
fjtirado commented 1 year ago

@eloycoto Can you attach the gitlab spec file for the latter stack trace?

fjtirado commented 1 year ago

@eloycoto I have opened https://github.com/OpenAPITools/openapi-generator/issues/16531 for one of the compilation issues.

fjtirado commented 1 year ago

Opened PR https://github.com/quarkiverse/quarkus-openapi-generator/pull/468

fjtirado commented 12 months ago

@eloycoto Im closing this issue since all compilation issues for https://raw.githubusercontent.com/github/rest-api-description/main/descriptions/ghes-3.10/ghes-3.10.json and https://github.com/konveyor/move2kube-api/blob/main/assets/openapi.jsonb are now solved. Im now investigating the Kogito part of the issue