You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ObjectMapper.acceptJsonFormatVisitor carries this javadoc:
Method for visiting type hierarchy for given type, using specified visitor. Visitation uses Serializer hierarchy and related properties
This method can be used for things like generating JSON Schema instance for specified type.
The implementation in BeanSerializerBase.acceptJsonFormatVisitor iterates the serializer-internal _props, which BeanSerializerFactory builds without @JsonProperty(access = WRITE_ONLY) properties (POJOPropertyBuilder.removeNonVisible clears the field, _removeUnwantedProperties drops the now-invisible entry). Schema modules that delegate via this entry point lose WRITE_ONLY properties from the generated schema; I observed this in jackson-module-jsonSchema, jackson-dataformat-avro, and jackson-dataformat-protobuf (2.19.4 of each), as well as in a third-party schema-generating dataformat.
Schema-purpose (javadoc): WRITE_ONLY is part of the logical property model — clients of the schema need to know they can send the value.
Serializer-internal (implementation): the visitor faithfully reflects what the serializer would emit, and WRITE_ONLY genuinely does not land in output.
Each is defensible; the question is which one the project intends. The related schema-side report jackson-module-jsonSchema#130 has been open since 2018-04-29 without that decision being made explicit either way.
Question
I'd like to understand the project's intended contract here.
(a) Schema-purpose. Then acceptJsonFormatVisitor (or the introspection that feeds it) should surface WRITE_ONLY.
(b) Serializer-internal. Then a one-line javadoc clarification on ObjectMapper.acceptJsonFormatVisitor would save the next schema-generating module from rediscovering this; downstream modules can carry their own schema-context introspection.
I missed the second javadoc line — "Visitation uses Serializer hierarchy and related properties" — which makes the serializer-internal intent explicit. Closing as self-resolved.
I missed the second javadoc line — "Visitation uses Serializer hierarchy and related properties" — which makes the serializer-internal intent explicit. Closing as self-resolved.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
I missed the second javadoc line — "Visitation uses
Serializerhierarchy and related properties" — which makes the serializer-internal intent explicit. Closing as self-resolved.