Skip to content

Commit

Permalink
Handle both types of additional properties when getting type declarat…
Browse files Browse the repository at this point in the history
…ion (#18201)
  • Loading branch information
njerig committed Mar 23, 2024
1 parent 8288b6f commit aedf571
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -171,9 +171,13 @@ public String getTypeDeclaration(Schema p) {

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
Expand Down

0 comments on commit aedf571

Please sign in to comment.