Json Api Validator

screenshot of Json Api Validator
ember

[WIP] json-api validation utils for applications built with ember-data

Overview

The @ember-data/json-api-validator package is a powerful tool designed for applications built on Ember Data. It focuses on validating JSON:API payloads, ensuring that all data pushed into the Ember Data store complies with the expected JSON:API standards. Often, developers encounter obscure errors when working with Ember Data, and this package helps to catch these errors early by validating payloads before they cause issues in the application.

By automatically integrating into the Ember Data store, this addon streamlines the development process. It not only reduces the likelihood of errors by enforcing proper data formats but also enhances clarity in error reporting. Whether you're a seasoned developer or a newcomer to Ember, having reliable validation tools can significantly improve your workflow.

Features

  • Automatic Integration: This addon seamlessly hooks into the Ember Data store, ensuring that any data pushed into it is validated against the JSON:API specification.

  • Model Definition Awareness: It takes into account available model definitions and Ember Data’s unique characteristics, such as camelCase member names and singular, dasherized types.

  • Configurable Validation: Users can configure the addon to either ignore unknown attributes and relationships or to issue warnings or assertions, providing flexibility based on project needs.

  • Relationship Validation: It confirms that synchronous relationships specified in the payload are included, which can be adjusted to issue warnings instead of strict errors.

  • Polymorphic Association Checking: The addon validates polymorphic associations to ensure types pushed match sub-classes of the expected base type.

  • Standalone Validation Methods: In addition to its automatic store validation, it offers a validateJsonApiDocument method for users to validate JSON:API payloads independently, without needing context from model schemas.

  • Comprehensive Testing Support: The package includes commands for linting, testing across different Ember versions, and running a dummy application, making it easy to ensure the validator works as intended in any environment.

ember
Ember

Ember.js is a productive, battle-tested JavaScript framework for building modern web applications. It includes everything you need to build rich UIs that work on any device.

typescript
Typescript

TypeScript is a superset of JavaScript, providing optional static typing, classes, interfaces, and other features that help developers write more maintainable and scalable code. TypeScript's static typing system can catch errors at compile-time, making it easier to build and maintain large applications.