Skip to content

Schema Overview

npm versionChangelog

@feathersjs/schema provides a way to define data models and to dynamically resolve them. It comes in in the following main parts:

  • JSON schema using TypeBox or plain JSON schema to define a data model with TypeScript types and validations. This allows us to:
    • Automatically get TypeScript types from schema definitions
    • Automatically generate API documentation
    • Create database adapter models without duplicating the data format
  • Validators take a TypeBox or JSON schema to validate data to
    • Ensure data is valid and always in the right format
    • Validate query string queries and convert them to the right type
  • Resolvers - Resolve properties based on a context (usually the hook context). This can be used for many different things like:
    • Adding default and computed values
    • Populating associations
    • Securing queries and e.g. limiting requests to a user
    • Removing protected properties for external requests
    • Ability to add read- and write permissions on the property level
    • Hashing passwords and validating dynamic password policies

Released under the MIT License.