@@ -397,7 +397,7 @@ private void processNestedSchemas(Schema schema, Set<Schema> visitedSchemas) {
397397 if (ModelUtils .isMapSchema (schema ) && ModelUtils .getAdditionalProperties (schema ) != null ) {
398398 Schema mapValueSchema = ModelUtils .getAdditionalProperties (schema );
399399 mapValueSchema = ModelUtils .getReferencedSchema (openAPI , mapValueSchema );
400- if (ModelUtils .isArraySchema (mapValueSchema ) || (! ModelUtils .isMapSchema (mapValueSchema ) && !ModelUtils .isModel (mapValueSchema ))) {
400+ if (ModelUtils .isArraySchema (mapValueSchema ) || (ModelUtils .isMapSchema (mapValueSchema ) && !ModelUtils .isModel (mapValueSchema ))) {
401401 Schema innerSchema = generateNestedSchema (mapValueSchema , visitedSchemas );
402402 schema .setAdditionalProperties (innerSchema );
403403
@@ -1053,6 +1053,21 @@ public GeneratorLanguage generatorLanguage() {
10531053 return GeneratorLanguage .PROTOBUF ;
10541054 }
10551055
1056+
1057+ /**
1058+ * Handles additionalProperties defined in composed schemas (e.g., allOf) by injecting into the model's properties.
1059+ * Example:
1060+ * components:
1061+ * schemas:
1062+ * Dog:
1063+ * allOf:
1064+ * - $ref: '#/components/schemas/DogBase'
1065+ * - type: object
1066+ * additionalProperties:
1067+ * title: pet
1068+ * $ref: '#/components/schemas/Pet'
1069+ * In this case, the second allOf that defines a map with string keys and Pet values will be part of model's property.
1070+ */
10561071 @ Override
10571072 protected void addProperties (Map <String , Schema > properties , List <String > required , Schema schema , Set <Schema > visitedSchemas ){
10581073 super .addProperties (properties , required , schema , visitedSchemas );
@@ -1072,5 +1087,4 @@ protected void addProperties(Map<String, Schema> properties, List<String> requir
10721087 properties .put (addtionalPropertiesName , schema );
10731088 }
10741089 }
1075-
10761090}
0 commit comments