Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: validate json array order if strict mode #1155

Merged

Conversation

novarx
Copy link

@novarx novarx commented May 1, 2024

See #1157
A follow up to #1102
It seems that not validating the order of json arrays if strict is not the desired behaviour.

see #1102 (comment)

@novarx
Copy link
Author

novarx commented May 1, 2024

@bbortt

@etieskrill
Copy link

etieskrill commented May 1, 2024

I think there is the need to configure the json array ordering separately from the strict mode. This should be configurable on a per-test basis. Probably by adding a new field to org.citrusframework.validation.json.JsonMessageValidationContext, something like checkArrayOrder, and choosing the validation method for array items based off of the new property, instead of strict. If the property was not set explicitly, the default should be false if non-strict, and true if strict, i think.

@novarx novarx marked this pull request as draft May 3, 2024 14:38
@bbortt bbortt marked this pull request as ready for review May 6, 2024 11:15
Copy link
Collaborator

@tschlat tschlat left a comment

Choose a reason for hiding this comment

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

lgtm

To have this properly documented, I kindly ask to create an issue to document the change, that non strict json validation now allows additional elements at any position in the array, while still enforcing the correct order of the control array elements.

src/manual/validation-json.adoc Outdated Show resolved Hide resolved
Copy link
Collaborator

@bbortt bbortt left a comment

Choose a reason for hiding this comment

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

I'm fine with the current solution, knowing that @etieskrill is working on another feature to make this even more customizable.

@bbortt bbortt linked an issue May 7, 2024 that may be closed by this pull request
@novarx novarx force-pushed the fix/json-array-order-validation branch from 7f68853 to ada6350 Compare May 7, 2024 13:53
@novarx novarx requested a review from tschlat May 7, 2024 13:54
@bbortt bbortt merged commit 59fc552 into citrusframework:main May 8, 2024
1 check passed
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.

Revert JsonArray order validation
4 participants