Skip to content

Commit a743635

Browse files
committed
[Java][Native] Fix POJO with additionalProperties to not extend HashMap
1 parent 81cdc82 commit a743635

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaClientCodegen.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -615,6 +615,13 @@ public void processOpts() {
615615
supportingFiles.add(new SupportingFile("JSON.mustache", invokerFolder, "JSON.java"));
616616
supportingFiles.add(new SupportingFile("AbstractOpenApiSchema.mustache", modelsFolder, "AbstractOpenApiSchema.java"));
617617
forceSerializationLibrary(SERIALIZATION_LIBRARY_JACKSON);
618+
619+
// Composed schemas can have the 'additionalProperties' keyword, as specified in JSON schema.
620+
// In principle, this should be enabled by default for all code generators. However due to limitations
621+
// in other code generators, support needs to be enabled on a case-by-case basis.
622+
// The flag below should be set for all Java libraries, but the templates need to be ported
623+
// one by one for each library.
624+
supportsAdditionalPropertiesWithComposedSchema = true;
618625
} else if (libRestEasy) {
619626
supportingFiles.add(new SupportingFile("JSON.mustache", invokerFolder, "JSON.java"));
620627
forceSerializationLibrary(SERIALIZATION_LIBRARY_JACKSON);

0 commit comments

Comments
 (0)