02/09/2024 Fix Discard Invalid Data Rule

🐛 Bug Fix

Nested errors that should be discarded can cause the request to fail.

  1. Validation Error Reading:

    • The refactored code now reads validation errors across the entire array, not just focusing on deep nested fields. This ensures that all validation errors are considered during processing.

  2. Required vs. Optional Fields:

    • For each field with a validation error, the code checks its associated validation rules.

    • If a field is marked as required, it will not be removed from the request. Instead, an exception will be thrown, making it clear that the field is both required and invalid.

    • Optional fields that have validation errors will be removed from the request to ensure the request remains valid.

  3. Debugging and Error Identification:

    • With this refactor, it is now easier to debug and identify invalid fields. If the discard_invalid_data rule is applied and an exception is thrown, it will clearly indicate that the issue lies with a required field.

👩‍💻 Mya Skylar

Last updated