Skip to content

Add new option to handle properties not part of current active @JsonView - #4275

Merged
cowtowncoder merged 4 commits into
FasterXML:2.17from
JooHyukKim:4108-multiple-view-option
Dec 22, 2023
Merged

cowtowncoder merged 4 commits into
FasterXML:2.17from
JooHyukKim:4108-multiple-view-option

Conversation

@JooHyukKim

Copy link
Copy Markdown
Member

resolves both #4108 and #437

@cowtowncoder

Copy link
Copy Markdown
Member

Whoa! This is AWESOME! Getting to solve old AND "Most wanted" issue(s). Well done.

@cowtowncoder
cowtowncoder merged commit ef4f292 into FasterXML:2.17 Dec 22, 2023
@toolforger

Copy link
Copy Markdown
 * In Jackson 2.x, this feature is disabled by default to maintain backward compatibility.
 * In Jackson 3.x, this feature may be enabled by default.

That's just how it should be, awesome!

@cowtowncoder

Copy link
Copy Markdown
Member

We'd need a PR to change defaults (and Javadoc) for 3.0 (master) if anyone has time?

// [databind#4108]: fields in other views to be considered as unknown properties
if (ctxt.isEnabled(DeserializationFeature.FAIL_ON_UNEXPECTED_VIEW_PROPERTIES)){
ctxt.reportInputMismatch(handledType(),
String.format("Input mismatch while deserializing %s. Property '%s' is not part of current active view [%s]",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just realized one idea: should this suggest disabling of feature to allow?
(not 100% sure but might be helpful, esp. when 3.0 changes default to enabled)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, not only we state the problem, but also inform a possible solution. Makes sense, will try to propose a improved version! 👍🏼

@JooHyukKim

Copy link
Copy Markdown
Member Author

We'd need a PR to change defaults (and Javadoc) for 3.0 (master) if anyone has time?

Will do 👍🏼 cc @cowtowncoder

@JooHyukKim
JooHyukKim deleted the 4108-multiple-view-option branch December 23, 2023 01:31
cowtowncoder added a commit to FasterXML/jackson-dataformats-text that referenced this pull request Jan 13, 2024
…e.FAIL_ON_UNEXPECTED_VIEW_PROPERTIES enabled by default in 3.0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants