Description
Since 7.24.0 (via #23993), JavaSpring/pojo.mustache emits @JsonInclude(JsonInclude.Include.NON_NULL) on every optional non-nullable field.
Field-level @JsonInclude takes precedence over the project ObjectMapper inclusion (e.g. Spring Boot's spring.jackson.default-property-inclusion=non_empty). On upgrade, projects with a stricter global setting silently observe a wire change: fields that were previously omitted (empty collections, empty strings) begin to serialize because per-field NON_NULL is looser than the project default.
What's the recommended path for consumers who need the project ObjectMapper to remain the source of truth for inclusion policy? Field-level @JsonInclude on generated models overrides any global setting, so projects relying on spring.jackson.default-property-inclusion (or an equivalent customizer) can no longer enforce it uniformly on generated types.
Reproduction (for context)
Spring Boot application.yml:
spring:
jackson:
default-property-inclusion: non_empty
Optional non-nullable String / List / Map<K,V> fields on a generated model. Response body on 7.23 omits empty values (global NON_EMPTY); on 7.24 emits "field": "", "list": [], "map": {} (field-level NON_NULL wins).
openApiNullable=false, Spring Boot 3.x, Jackson 2.x. Verified live.
Description
Since 7.24.0 (via #23993),
JavaSpring/pojo.mustacheemits@JsonInclude(JsonInclude.Include.NON_NULL)on every optional non-nullable field.Field-level
@JsonIncludetakes precedence over the projectObjectMapperinclusion (e.g. Spring Boot'sspring.jackson.default-property-inclusion=non_empty). On upgrade, projects with a stricter global setting silently observe a wire change: fields that were previously omitted (empty collections, empty strings) begin to serialize because per-fieldNON_NULLis looser than the project default.What's the recommended path for consumers who need the project
ObjectMapperto remain the source of truth for inclusion policy? Field-level@JsonIncludeon generated models overrides any global setting, so projects relying onspring.jackson.default-property-inclusion(or an equivalent customizer) can no longer enforce it uniformly on generated types.Reproduction (for context)
Spring Boot
application.yml:Optional non-nullable String / List / Map<K,V> fields on a generated model. Response body on 7.23 omits empty values (global NON_EMPTY); on 7.24 emits "field": "", "list": [], "map": {} (field-level NON_NULL wins).
openApiNullable=false, Spring Boot 3.x, Jackson 2.x. Verified live.