-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Closed
Labels
2.19Issues planned at 2.19 or laterIssues planned at 2.19 or laterto-evaluateIssue that has been received but not yet evaluatedIssue that has been received but not yet evaluated
Description
Search before asking
- I searched in the issues and found nothing similar.
Describe the bug
Hi,
When upgrading from 2.18.5 to 2.19.0+ (I tested up to latest 2.20.1), I noticed that while before, generating the schema (using JsonSchemaGenerator but I suspect with anything using ObjectWriter.acceptJsonFormatVisitor()?), would omit the property annotated with @JsonAnyGetter from the schema, now it will include it.
I don't know if it's on purpose but it feels wrong in the sense that the serialization of an object would not include that property but only its keys instead (which can't be discovered during schema generation of course, but it's a separate matter IMO).
Version Information
2.20.1
Reproduction
public final class Test {
@JsonAnyGetter
Map<String, Object> getMyProperties() {
return Map.of();
}
public static void main(String[] args) throws Exception {
// 2.18.5 gives {}
// 2.19.0+ gives {getMyProperties=com.fasterxml.jackson.module.jsonSchema.types.ObjectSchema@34123d65}
System.out.println(
((ObjectSchema) new JsonSchemaGenerator(new ObjectMapper()).generateSchema(Test.class))
.getProperties()
);
}
}Expected behavior
No response
Additional context
No response
Metadata
Metadata
Assignees
Labels
2.19Issues planned at 2.19 or laterIssues planned at 2.19 or laterto-evaluateIssue that has been received but not yet evaluatedIssue that has been received but not yet evaluated