From 1a0096843a60b5f4298e6b62dfc4c1a64b0bf635 Mon Sep 17 00:00:00 2001 From: Rahul Singh <43885405+ChiChuRita@users.noreply.github.com> Date: Thu, 13 Aug 2026 17:07:29 +0200 Subject: [PATCH] docs: add shorn to the ecosystem page --- ark/docs/content/docs/ecosystem/index.mdx | 25 +++++++++++++++++++++++ ark/docs/content/docs/ecosystem/meta.json | 2 +- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/ark/docs/content/docs/ecosystem/index.mdx b/ark/docs/content/docs/ecosystem/index.mdx index 840ee2d2f..bd80c3231 100644 --- a/ark/docs/content/docs/ecosystem/index.mdx +++ b/ark/docs/content/docs/ecosystem/index.mdx @@ -69,3 +69,28 @@ export default defineConfig({ ``` > For more details, see the [Getting Started guide](https://use-drzl.github.io/drzl/guide/getting-started.html). + +### shorn + +[shorn](https://shorn.dev) turns an ArkType type into compact binary serialization. Field names and type tags stay out of the payload because the type already provides them, so there is no schema language to learn and nothing to generate. + +ArkType 2.1.28 and newer implements both [Standard Schema](https://standardschema.dev/schema) and [Standard JSON Schema](https://standardschema.dev/json-schema), so a type can be passed straight to `encode`. Validation runs on encode and again on decode. + +```ts +// @noErrors +import { type } from "arktype" +import { decode, encode } from "@chichurita/shorn" + +const Person = type({ + name: "string", + age: "number.integer >= 0", + sex: "'M' | 'F' | 'X'" +}) + +const bytes = encode(Person, { name: "Grace", age: 45, sex: "F" }) +bytes.length // 8, where the same record is 35 bytes of minified JSON + +decode(Person, bytes) // typed and validated +``` + +> ArkType objects are open by default, so shorn rejects undeclared properties during encoding rather than dropping data. Use `"+": "delete"` to strip expected extras. See the [ArkType guide](https://shorn.dev/validators/arktype/) for the details. diff --git a/ark/docs/content/docs/ecosystem/meta.json b/ark/docs/content/docs/ecosystem/meta.json index 3413f3191..7df96ea84 100644 --- a/ark/docs/content/docs/ecosystem/meta.json +++ b/ark/docs/content/docs/ecosystem/meta.json @@ -1,5 +1,5 @@ { "title": "Ecosystem", "icon": "New", - "pages": ["[ArkEnv](/docs/ecosystem#arkenv)", "[DRZL](/docs/ecosystem#drzl)"] + "pages": ["[ArkEnv](/docs/ecosystem#arkenv)", "[DRZL](/docs/ecosystem#drzl)", "[shorn](/docs/ecosystem#shorn)"] }