-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Labels
documentationImprovements or additions to documentationImprovements or additions to documentationgood first issueGood for newcomersGood for newcomers
Description
By "data validation" I mean validating the actual values of the payload, not just the types. For example, we may want to check that a field is not blank.
I'm hesitant to use the term "form validation" since this library isn't really for form validation. It can certainly be used to help with form validation, but it's a bit redundant. It's more appropriate to use this for an API meant for third party consumers.
The straightforward approach to using this library for data validation would be:
- Input a JSON payload
- Use
CompareMapToStruct()to check the types, and return the errors if there are any - Unmarshal the JSON into
dstand check the values using some validation logic, and return the errors if there are any
There are plenty of data validation libraries out there, like ozzo-validation, which would work pretty seamlessly with this.
Metadata
Metadata
Assignees
Labels
documentationImprovements or additions to documentationImprovements or additions to documentationgood first issueGood for newcomersGood for newcomers