Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -603,6 +603,7 @@ public Map<String, ModelsMap> postProcessAllModels(Map<String, ModelsMap> objs)
objsValue.put("classname", cm.classname);
objsValue.putAll(additionalProperties);
objs.put(cm.name, objsValue);
objsValue.put("javaxPackage", additionalProperties.getOrDefault("javaxPackage", "javax"));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2: This line is redundant: objsValue.putAll(additionalProperties) two lines above already copies javaxPackage into objsValue for Java generators, because applyJavaxPackage()/applyJakartaPackage() write it into additionalProperties during processOpts(), before postProcessAllModels() runs. The new put overwrites the same key with the same value, so it cannot change the template context for Java. If the oneOf interface was still rendering javax, this line does not fix it — the real cause is likely how the oneOf template consumes the model map entries, not a missing context property. Verify the actual rendering path or remove this no-op.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java, line 606:

<comment>This line is redundant: `objsValue.putAll(additionalProperties)` two lines above already copies `javaxPackage` into `objsValue` for Java generators, because `applyJavaxPackage()`/`applyJakartaPackage()` write it into `additionalProperties` during `processOpts()`, before `postProcessAllModels()` runs. The new `put` overwrites the same key with the same value, so it cannot change the template context for Java. If the oneOf interface was still rendering `javax`, this line does not fix it — the real cause is likely how the oneOf template consumes the model map entries, not a missing context property. Verify the actual rendering path or remove this no-op.</comment>

<file context>
@@ -603,6 +603,7 @@ public Map<String, ModelsMap> postProcessAllModels(Map<String, ModelsMap> objs)
                 objsValue.put("classname", cm.classname);
                 objsValue.putAll(additionalProperties);
                 objs.put(cm.name, objsValue);
+                objsValue.put("javaxPackage", additionalProperties.getOrDefault("javaxPackage", "javax"));
             }
 
</file context>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

i don't think default codegen should store java specified values (e.g. javaxPackage).

can this be fix in java abstract code gen instead?

}

// Gather data from all the models that contain oneOf into OneOfImplementorAdditionalData classes
Expand Down
Loading