Standards Docs
ReferenceSchema

object

Create a new object builder with type inference

Create a new object builder with type inference

Signature

(config: BuilderConfig): ObjectBuilder<{}>

Examples

```typescript
import { object, text, number } from "@stndrds/schema";
import type { ExtractRecord } from "@stndrds/schema";

// Define object with fluent API (system:true by default — immutable at runtime)
const PRODUCT = object({ name: "products", label: "Product" })
  .attribute(text({ name: "name", label: "Name" }).required())
  .attribute(number({ name: "price", label: "Price" }));

// Extract the inferred record type
type ProductRecord = ExtractRecord<typeof PRODUCT>;
// → { name: string; price?: number }

// Full autocompletion when creating records! ✨
const product: ProductRecord = {
  name: "Nike Air Max",  // required
  price: 129.99          // optional
};

On this page