JSON Schema

    What is JSON Schema?

    JSON Schema is an open standard for defining the structure of JSON data. Learn more about it on their website.

    A simple schema for a user object might look like this:

    Creating a JSON Schema

    To start, install the @noya-app/noya-multiplayer-react package if you haven't already:

    npm install @noya-app/noya-multiplayer-react
    

    Noya provides utility functions for creating a JSON Schema and inferring its TypeScript type:

    Under the hood, we're actually re-exporting the typebox library. This library allows you to create both a TypeScript type and JSON schema from a single definition. (You're welcome to use typebox directly, rather than importing our copy)