A
A
Altai902018-10-18 20:58:41
Validation
Altai90, 2018-10-18 20:58:41

How to validate the data coming from the back on the front?

Something I can not understand in which direction to dig. It happens that on the back, the programmer, without saying anything to anyone, refactors (we remove the moral side of this issue, they say, we must warn, etc. We take the worst case, when the back is irreplaceable and it does not work out to influence its behavior). In parallel, work is underway at the front. As a result, it takes n-th amount of time to find out who did the kaku. How can you automate checking the incoming data for the required fields, their type, etc.
And immediately one more question - how to validate the data, if there is a condition. For example, if there is a "someField" field in the JSON-chik, then substitute one validation. If instead of it "anotherField" - then another validation

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Altai90, 2018-10-20
@Altai90

In general, who is interested - dig towards JSON Schema and ajv

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question