Repository navigation
Conversation
There was a problem hiding this comment.
3 issues found across 52 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="modules/openapi-generator/src/test/java/org/openapitools/codegen/java/jaxrs/JavaJAXRSSpecCompileSupport.java">
<violation number="1" location="modules/openapi-generator/src/test/java/org/openapitools/codegen/java/jaxrs/JavaJAXRSSpecCompileSupport.java:101">
P2: `compileModels` can fail unguarded tests on the project's supported JDK 11 because `javac --release 17` is unavailable there. Guard this helper with `requireJdk(17)` (or pass a supported release) so every caller skips cleanly on older JDKs.</violation>
</file>
<file name="modules/openapi-generator/src/test/resources/3_0/jaxrs-spec/jsonb_polymorphism.yaml">
<violation number="1" location="modules/openapi-generator/src/test/resources/3_0/jaxrs-spec/jsonb_polymorphism.yaml:20">
P2: `Car` declares `carType` as its discriminator but does not require that property. OpenAPI 3.0 requires discriminator properties to be required, so schema validators and consumers can reject this fixture; add `carType` to the inline schema’s `required` list.</violation>
</file>
<file name="samples/server/petstore/jaxrs-spec-sealed-jsonb/README.md">
<violation number="1" location="samples/server/petstore/jaxrs-spec-sealed-jsonb/README.md:17">
P2: This run command targets TomEE 7, but the sample requires Java 17 and Jakarta EE APIs. Use a Jakarta-compatible TomEE 10 embedded plugin version, or remove the launch command.</violation>
</file>
Reply with feedback, questions, or to request a fix.
View guided diff | Re-trigger cubic
| } | ||
| } | ||
| Path classes = output.resolve("classes"); | ||
| CompileResult result = compile(sources, classes, "17", classpath); |
There was a problem hiding this comment.
P2: compileModels can fail unguarded tests on the project's supported JDK 11 because javac --release 17 is unavailable there. Guard this helper with requireJdk(17) (or pass a supported release) so every caller skips cleanly on older JDKs.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At modules/openapi-generator/src/test/java/org/openapitools/codegen/java/jaxrs/JavaJAXRSSpecCompileSupport.java, line 101:
<comment>`compileModels` can fail unguarded tests on the project's supported JDK 11 because `javac --release 17` is unavailable there. Guard this helper with `requireJdk(17)` (or pass a supported release) so every caller skips cleanly on older JDKs.</comment>
<file context>
@@ -0,0 +1,165 @@
+ }
+ }
+ Path classes = output.resolve("classes");
+ CompileResult result = compile(sources, classes, "17", classpath);
+ assertEquals(result.exitCode, 0, result.diagnostics);
+ return classes;
</file context>
| CompileResult result = compile(sources, classes, "17", classpath); | |
| requireJdk(17); | |
| CompileResult result = compile(sources, classes, "17", classpath); |
| required: | ||
| - petType | ||
| - name | ||
| properties: |
There was a problem hiding this comment.
P2: Car declares carType as its discriminator but does not require that property. OpenAPI 3.0 requires discriminator properties to be required, so schema validators and consumers can reject this fixture; add carType to the inline schema’s required list.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At modules/openapi-generator/src/test/resources/3_0/jaxrs-spec/jsonb_polymorphism.yaml, line 20:
<comment>`Car` declares `carType` as its discriminator but does not require that property. OpenAPI 3.0 requires discriminator properties to be required, so schema validators and consumers can reject this fixture; add `carType` to the inline schema’s `required` list.</comment>
<file context>
@@ -0,0 +1,142 @@
+ required:
+ - petType
+ - name
+ properties:
+ petType:
+ type: string
</file context>
| Please execute the following: | ||
|
|
||
| ``` | ||
| mvn -Dtomee-embedded-plugin.http=8080 package org.apache.tomee.maven:tomee-embedded-maven-plugin:7.0.5:run |
There was a problem hiding this comment.
P2: This run command targets TomEE 7, but the sample requires Java 17 and Jakarta EE APIs. Use a Jakarta-compatible TomEE 10 embedded plugin version, or remove the launch command.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At samples/server/petstore/jaxrs-spec-sealed-jsonb/README.md, line 17:
<comment>This run command targets TomEE 7, but the sample requires Java 17 and Jakarta EE APIs. Use a Jakarta-compatible TomEE 10 embedded plugin version, or remove the launch command.</comment>
<file context>
@@ -0,0 +1,27 @@
+Please execute the following:
+
+```
+mvn -Dtomee-embedded-plugin.http=8080 package org.apache.tomee.maven:tomee-embedded-maven-plugin:7.0.5:run
+```
+
</file context>
| mvn -Dtomee-embedded-plugin.http=8080 package org.apache.tomee.maven:tomee-embedded-maven-plugin:7.0.5:run | |
| mvn -Dtomee-embedded-plugin.http=8080 package org.apache.tomee.maven:tomee-embedded-maven-plugin:10.0.0:run |
Summary
Adds JSON-B discriminator-based polymorphic deserialization support to the Java JAX-RS Spec server generator.
Depends on #25662. This is a follow-up to the abstract models and sealed discriminator hierarchies PR. Please review and merge #25662 first.
Until #25662 is merged, this PR includes both commits in the GitHub comparison. The JSON-B-specific changes are contained in commit
88ef700f952.Changes
jsonbDiscriminatorDeserializersgenerator option.@JsonbCreator, inherited models,oneOfinterfaces, and discriminator mappings.JsonbPolymorphismProcessorand corresponding Mustache templates.Validation
./mvnw clean package— BUILD SUCCESS (all 8 modules; Maven Central used via a separate settings file)../bin/generate-samples.sh bin/configs/jaxrs-spec-sealed-jsonb.yaml— successful, no generated changes../bin/utils/export_docs_generators.sh— completed, no generated changes.PR checklist
Dependency
PR #25662 introduces the abstract and sealed model support used by this implementation. After #25662 is merged, this PR should contain only the JSON-B-specific changes relative to
master.Summary by cubic
Adds JSON-B discriminator-based polymorphic deserialization to the JAX-RS Spec server generator. Previously, discriminator hierarchies deserialized as their declared type; now the new
jsonbDiscriminatorDeserializersoption generates deserializers that resolve the concrete class from the discriminator value. This builds on the abstract models and sealed hierarchy support and should be reviewed and merged after that PR.New Features
oneOfinterfaces, inherited models,@JsonbCreator, and discriminator mappings.Map<String, Pet>(alsoList<Pet>on 3.0.2) are not covered; Johnzon 2.0.2 to 2.2.0 has a missing-required-container limitation.Written for commit 88ef700. Summary will update on new commits.