Skip to content

Custom Jackson Bean(De)seralizerModifier is not considered when inferring Schema #2945

@haisi

Description

@haisi

Is your feature request related to a problem? Please describe.

I use a custom Jackson BeanSerializerModifier.
However, springdoc does not consider this customisation when inferring the Schema.

In this specific case, the SingleValueWrappingTypeSerializerModifier unwraps value-objects (annotated or interface-marked with jMolecules DDD types) containing a single "base-type".

record Email(String value) implements ValueObject {}
// vs. otherwise
record Email(@JsonValue String value) implements ValueObject {}

Meaning, instead of generating a schema like this:
before wrapper

The schema contains a nested structure for the value object --- despite Jackson serialising the object flat
after wrapper with

Describe the solution you'd like

  • The automatically generated schema matches "somehow" what Jackson produces --- despite custom seralizer modifiers.

Describe alternatives you've considered

  • For my use-case, simply adding an @Schema with either an example or explicitly defining the type works
  • Skip the custom serializer all together and always, explicitly use @JsonValue

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions