OpenAPITools / OpenAPITools/openapi-generator

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

Open
#13,855 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Issue: Bug
Dominant language
Java
Stars
26.8k
Forks
7.7k
PR merge metrics
PR metrics pending

Description

Bug Report Checklist
  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • Have you tested with the latest master to confirm the issue still exists?
  • Have you searched for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Sponsorship to speed up the bug fix or feature request (example)
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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the generated samples under samples/server/petstore/java-helidon-server/mp and /se, using Java 17 and the provided Maven commands to reproduce both startup failures. Read the generator configuration and the OpenAPI fixture at modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml. Done means both generated sample servers build and start without the reported Jersey or MicroProfile OpenAPI errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api, backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.