bee icon indicating copy to clipboard operation
bee copied to clipboard

refactor: simplify input validation

Open umerm-work opened this issue 2 years ago • 1 comments

Checklist

  • [x] I have read the coding guide
  • [ ] My change requires a documentation update and I have done it
  • [ ] I have added tests to cover my changes.
  • [ ] I have filled out the description and linked the related issues

Description

Simplify input to remove repetitiveness.

Closes #3163

Motivation and context (Optional)

Related Issue (Optional)

Screenshots (if appropriate):


This change is Reviewable

umerm-work avatar Aug 22 '22 07:08 umerm-work

This will require a lot of modification in test cases. I tried to keep the test cases intact.

It will require changing the returned test results, which is perfectly fine since we want to unify the responses anyway.

So if we want to apply validation, we must do it before parsing.

Before parsing you only have length information and this is only relevant in some cases, otherwise, you need to parse the value successfully first and then perform validation, so validation after parsing makes more sense.

The validation library doesn't support our custom types, so it's better to have a custom implementation.

You can use custom validators from the validation library: "Cross Field and Cross Struct validations by using validation tags or custom validators."

mrekucci avatar Sep 19 '22 06:09 mrekucci

Closed in favor of #3344

mrekucci avatar Sep 30 '22 16:09 mrekucci