Skip to content

Conversation

@deadlycoconuts
Copy link
Collaborator

What this PR does / why we need it:
This PR introduces an additional fix to the yup validation schema, as a follow up from #80. In particular, the fix in this PR addresses this change:

  • When using the same Schema.when function but passing a function directly as an argument instead of the builder object, the signature of the expected function has also been updated from (value, schema)=> Schema): Schema to (values: any[], schema) => Schema): Schema.

    Existing schemas that do not follow this convention now have been updated to reflect the new expected array:

    Example:

    // before
    some_field: yup.string().when("some_other_field", (some_other_field, schema) =>
      some_other_field ? yup.string().required("this is needed") : schema
    ),
    
    // after
    some_field: yup.string().when("some_other_field", ([some_other_field], schema) =>
      some_other_field ? yup.string().required("this is needed") : schema
    ),

Which issue(s) this PR fixes:

Fixes #

@deadlycoconuts deadlycoconuts added the bug Something isn't working label Aug 7, 2024
@deadlycoconuts deadlycoconuts self-assigned this Aug 7, 2024
@deadlycoconuts deadlycoconuts marked this pull request as ready for review August 7, 2024 13:58
Copy link
Collaborator

@tiopramayudi tiopramayudi left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks @deadlycoconuts

@deadlycoconuts
Copy link
Collaborator Author

Thanks for the quick review @tiopramayudi, I'll merge this after rebasing this branch once the other PR with the CICD fixes is merged!

@deadlycoconuts deadlycoconuts force-pushed the fix_segmenter_yup_validation branch from c11d725 to 75e0335 Compare August 8, 2024 04:19
@deadlycoconuts deadlycoconuts merged commit efc4e48 into caraml-dev:main Aug 8, 2024
@deadlycoconuts deadlycoconuts deleted the fix_segmenter_yup_validation branch August 8, 2024 08:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants