Use JSON schemas for Vue component prop validation
We already have JSON schemas for our API available that are used in backend tests (spec/fixtures/api/schemas
). Most of our Vue components that accept objects or arrays to be passed, don't validate them properly. We can use the existing schemas as validators for our Vue components. To not affect performance, we should only do so in development / test environment.
Steps needed:
- move
spec/fixtures/api/schemas
tolib/api/schemas
- add a JSON schema validator (for example https://www.npmjs.com/package/ajv) as dev dependency
- add helper function that validates against a given schema in development / test environment but does nothing in production