Handle both types of additional properties when getting type declaration (#18201)

This commit is contained in:
Njeri Gachoka 2024-03-23 02:42:22 -07:00 committed by GitHub
parent 8288b6fb15
commit aedf571811
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -171,9 +171,13 @@ public class ClojureClientCodegen extends DefaultCodegen implements CodegenConfi
return "(s/coll-of " + getTypeDeclaration(inner) + ")";
} else if (ModelUtils.isMapSchema(p)) {
Schema inner = (Schema) p.getAdditionalProperties();
return "(s/map-of string? " + getTypeDeclaration(inner) + ")";
Object additionalProperties = p.getAdditionalProperties();
// additionalProperties is either a Schema or a Boolean
if (additionalProperties instanceof Schema) {
Schema inner = (Schema) additionalProperties;
return "(s/map-of string? " + getTypeDeclaration(inner) + ")";
}
return "(s/map-of string? s/any?)";
}
// If it's a type we defined, we want to append the spec suffix