Schemas
Powered by the spruce-schema module, schemas are the universal way to define the shape of data in Spruce. There is also great typing support.
Validating Data
Creating a Schema in your Skill
Schemas are first class citizens in Spruce and your Skills. The best way to define a schema as the “source of truth” is to run the following to create a builder
. From that builder
, both the final schema and the TypeScript typings are generated.
Creating a schema builder
spruce create.schema
After you give your Schema
a name and a version, a .builder.ts
file will be created at:
/src/schemas/{version}/{name}.builder.ts
You can go in and make any edits you need and then sync
schemas after?
Syncing schemas
After you edit an builder
file, you can run the following command to sync your schema:
spruce sync.schemas