From 6b9c8c0bf04b22b50bee121e3a1fb8babda46f7a Mon Sep 17 00:00:00 2001 From: Taylor Romero Date: Sun, 11 Aug 2024 18:29:36 -0600 Subject: [PATCH] minor: schema progress --- src/pages/concepts/schemas.md | 47 ++++++++++++++++++++++++++++++++++- 1 file changed, 46 insertions(+), 1 deletion(-) diff --git a/src/pages/concepts/schemas.md b/src/pages/concepts/schemas.md index 494b2180..e757d3e5 100644 --- a/src/pages/concepts/schemas.md +++ b/src/pages/concepts/schemas.md @@ -1,6 +1,51 @@ # Schemas -Coming soon... +Powered by the [spruce-schema](https://github.com/sprucelabsai-community/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 + +```bash +spruce create.schema +``` + +After you give your `Schema` a name and a version, a `.builder.ts` file will be created at: + +```bash +/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: + +```bash +spruce sync.schemas +``` + +
+ +
+Accessing your built schema + +
+ + +### Creating a Schema programmatically + + ### Something Missing?