Skip to content

Conversation

@antoniocapelo
Copy link
Collaborator

@antoniocapelo antoniocapelo commented Jul 17, 2025

Fix: Allow computed values to work within conditional schema structures

Problem

Computed values from JSON Logic (x-jsf-logic-computedAttrs) were not being properly applied when used inside conditional schema structures like if/then/else statements and allOf/anyOf compositions. This prevented dynamic schema modifications based on computed values within these conditional contexts.

Solution

  • Extended computed value processing: Updated cycleThroughPropertiesAndApplyValues to recursively process computed values within if, allOf, and anyOf schema structures
  • Re-applied schema rules: Added logic to re-apply schema rules after computed values are applied, ensuring all conditional logic is properly re-evaluated with the updated schema

Changes

  • src/validation/json-logic.ts: Extended the computed values processing to handle conditional schemas (if, allOf, anyOf)
  • src/mutations.ts: Added re-application of schema rules after computed values are applied to ensure proper field updates
  • src/types.ts: Updated comment style for consistency
  • test/validation/json-logic.test.ts: Added test case demonstrating computed values working within conditional statements

Copy link
Collaborator

@dragidavid dragidavid left a comment

Choose a reason for hiding this comment

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

Left a comment or 2, otherwise its pretty solid imo!

@antoniocapelo
Copy link
Collaborator Author

@dragidavid can I get a re-review?

Copy link
Collaborator

@dragidavid dragidavid left a comment

Choose a reason for hiding this comment

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

Thanks for addressing the comments! All good 👌

@antoniocapelo antoniocapelo merged commit e082c61 into main Jul 22, 2025
5 checks passed
@antoniocapelo antoniocapelo deleted the devxp-3278-allow-for-const-validation-against-json-logic-validatio branch July 22, 2025 17:14
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.

4 participants