OpenAPITools / openapi-generator

OpenAPI Generator allows generation of API client libraries (SDK generation), server stubs, documentation and configuration automatically given an OpenAPI Spec (v2, v3)
https://openapi-generator.tech
Apache License 2.0
22.06k stars 6.62k forks source link

[BUG] java-helidon-server - Generated Helidon sample servers fail during start-up #13855

Open tjquinno opened 2 years ago

tjquinno commented 2 years ago

Bug Report Checklist

Description

The generated samples for java-helidon-server (both the se and mp libraries) fail during start-up.

openapi-generator version

Current master branch.

OpenAPI declaration file content or url

In this repo, at modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml

Generation Details

./bin/generate-samples.sh bin/configs/java-helidon-server-*

Steps to reproduce
cd samples/server/petstore/java-helidon-server/mp
# Use Java 17
mvn clean package
java -jar target/petstore-helidon-server-mp.jar 

The server start-up fails with

Exception in thread "main" org.glassfish.jersey.server.model.ModelValidationException: Validation of the application resource model has failed during application initialization.
[[FATAL] No injection source found for a parameter of type public org.openapitools.server.model.ModelApiResponse org.openapitools.server.api.PetServiceImpl.uploadFile(java.lang.Long,java.lang.String,java.io.InputStream) at index 2.; source=

followed by a long string.

cd samples/server/petstore/java-helidon-server/se
# Use Java 17
mvn clean package
java -jar target/petstore-helidon-server-se.jar 

The server start-up fails with several errors, among them this:

Exception in thread "main" Cannot create property=servers for JavaBean=io.smallrye.openapi.api.models.OpenAPIImpl@f99f5e0
 in 'reader', line 1, column 1:
    openapi: 3.0.0
    ^
Cannot create property=variables for JavaBean=io.smallrye.openapi.api.models.servers.ServerImpl@c7045b9
 in 'reader', line 12, column 3:
    - description: petstore server
      ^
Cannot create property=default for JavaBean=io.smallrye.openapi.api.models.servers.ServerVariableImpl@6cb6decd
 in 'reader', line 16, column 7:
          default: petstore
          ^
No writable property 'default' on class: org.eclipse.microprofile.openapi.models.servers.ServerVariable
 in 'reader', line 16, column 16:
          default: petstore
Related issues/PRs

I found no related issues or PRs, open or closed.

Suggest a fix

No idea yet. Looking.

tjquinno commented 2 years ago

I've found that the problem with the "se" server is clearly in Helidon. (helidon-io/helidon#5288)

Still checking on the "mp" side.