palantir / palantir/conjure-java

Add strictUnions option

Open
#2,498 0 comments 0 reactions 1 assignee View on GitHub

@Diego-Zulu is already working on this.

Since Mar 24, 2025.

Dominant language
Java
Stars
39
Forks
49
Avg merge
8h 22m
Merged PRs (30d)
32

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.