Skip to content

Add strictUnions option #2498

Description

@Diego-Zulu

Right now Bean generation can be made strict via the strictObjects option. This means that, if this option is provided, bean generator and build bean generator won't add the JsonIgnoreProperties decorator, which means deserialisation for these objects will fail if their definition contains unknown keys.

This option was not extended to union generators, so right now it is possible to commit accidental mistakes like:

my-union-type:
  type: first-type
  first-type:
    first-field: foo
  accidentally-indented-field: this should not be indented and sadly will be ignored because it is indented below a union type

To prevent this kind of accidental mistakes, it would be cool if we could have a new option strictUnions that would behave the same way as strictObjects but prevents the union generator from adding the JsonIgnoreProperties decorator.

I'll self assign this for now as I plan to take a stab at this and create a PR

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions