@@ -397,7 +397,7 @@ private void processNestedSchemas(Schema schema, Set<Schema> visitedSchemas) {
397
397
if (ModelUtils .isMapSchema (schema ) && ModelUtils .getAdditionalProperties (schema ) != null ) {
398
398
Schema mapValueSchema = ModelUtils .getAdditionalProperties (schema );
399
399
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 ))) {
401
401
Schema innerSchema = generateNestedSchema (mapValueSchema , visitedSchemas );
402
402
schema .setAdditionalProperties (innerSchema );
403
403
@@ -1053,6 +1053,21 @@ public GeneratorLanguage generatorLanguage() {
1053
1053
return GeneratorLanguage .PROTOBUF ;
1054
1054
}
1055
1055
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
+ */
1056
1071
@ Override
1057
1072
protected void addProperties (Map <String , Schema > properties , List <String > required , Schema schema , Set <Schema > visitedSchemas ){
1058
1073
super .addProperties (properties , required , schema , visitedSchemas );
@@ -1072,5 +1087,4 @@ protected void addProperties(Map<String, Schema> properties, List<String> requir
1072
1087
properties .put (addtionalPropertiesName , schema );
1073
1088
}
1074
1089
}
1075
-
1076
1090
}
0 commit comments