Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Clojure] Handle both types of additional properties when getting type declaration #18201

Merged
merged 1 commit into from
Mar 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i've filed #18212 to rename the variable to just ap as the generator itself also has a property/field named "additionalProperties"

// 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
Loading