Skip to content

Conversation

@jimevanssfdc
Copy link
Contributor

The Jackson JSON serialization library will attempt to coerce JSON values to Java data types when it is inappropriate. This leads to element properties being incorrect for the UTAM JSON grammar. For example, "public": "true" will incorrectly be coerced into a boolean value, when it should throw an error.

Moreover, newer versions of Jackson (2.16 and higher) will allow more liberal deserialization of properties that should have object values. This allows an invalid UTAM construct line "selector": "some-selector", which should error, as the value of the selector property is expected to be an object, not a string value.

This change fixes both issues, correctly throwing errors in cases where the wrong type of a property has been authored into the UTAM PO JSON declarative description file.

The Jackson JSON serialization library will attempt to coerce JSON values to
Java data types when it is inappropriate. This leads to element properties
being incorrect for the UTAM JSON grammar. For example, `"public": "true"`
will incorrectly be coerced into a boolean value, when it should throw
an error.

Moreover, newer versions of Jackson (`2.16` and higher) will allow more
liberal deserialization of properties that should have object values.
This allows an invalid UTAM construct line `"selector": "some-selector"`,
which should error, as the value of the `selector` property is expected
to be an object, not a string value.

This change fixes both issues, correctly throwing errors in cases where
the wrong type of a property has been authored into the UTAM PO JSON
declarative description file.
@jimevanssfdc jimevanssfdc merged commit 1b57c23 into dev Jun 17, 2025
4 checks passed
@jimevanssfdc jimevanssfdc deleted the jimevanssfdc/prevent-undesirable-json-type-coercion branch June 17, 2025 18:15
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