CodeSampleX

Sample

@sinclair/typebox 0.27.12: Type.Object

Verified sample for npm @sinclair/typebox 0.27.12: Type.Object. The contract ran on node 22 · linux debian/x64 · docker and passed.

sha256:6d62719ce9a80eb4bcd72ad0dc44b631f001053e01726b959f0cf11940c97c54

This network offers one thing: a sample that builds. It ran the sample in a sandbox and kept the signed receipt. It grades nothing and warrants nothing — whether the same code builds where you are is not something it measured. How many distinct signing keys filed a passing contract receipt. One is the author alone; more than one means somebody else built it too. A key is self-generated with nothing registered behind it, so it counts keys, not people. MIT-0

Execution evidence

The declared environment and the signed runs are kept apart, so you can see exactly what this sample ran and where.

Evidence basis
Signed contract pass
Verification receipts
1
Signing keys that built it
1
Declared environment node 22.23 linux 24 · ubuntu · glibc 2.39 x64 node 22.23 javascript npm 10

Verification-run environments

Environment Contract Stages Run
node 22 · linux debian/x64 · docker ed25519:c1973797be207ac4 PASS compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS
CONTAINER_RUN · node-typescript@1node:22@sha256:8a34c4ab3ea2…
2026-09-02

Case

HOW
Goal
verify Type.Object in pkg:npm/%40sinclair/typebox@0.27.12
Packages
Symbols
  • Type.Object
Environment
node 22.23.2
Created
2026-09-02T14:30:05Z

Contract

  1. Type.Object creates an object schema with properties and required list
  2. Type.Object excludes optional properties from the required list
  3. Type.Object supports additionalProperties constraint option
  4. Type.Object supports schema metadata options including title and description
  5. Type.Object supports nested object schema compositions

Files

  • PROMPT.md
  • csx.json
  • index.js
  • package-lock.json
  • package.json
  • spec.json
  • test/contract.cjs

Download the source artifact (tar.gz)

Source

PROMPT.md
Clean-room public code sample — generation instructions

Write a brand-new, minimal, self-contained code sample in this clean-room directory.
Do not copy, paraphrase, or reference any existing project source. Work only from this spec.

A csx.json manifest scaffold already exists. Do not recreate it from memory. Preserve its case.goal, packages and symbols; fill its empty case.contract with exact assertions and correct its environment, commands and verifierAdapter for the files you generate.

Goal: verify Type.Object in pkg:npm/%40sinclair/typebox@0.27.12
Kind: HOW

Use EXACTLY these public packages and versions:
  - pkg:npm/%40sinclair/typebox@0.27.12
Demonstrate these symbols/APIs:
  - Type.Object
Constraints:
  - executionContext: node
Required runtime conditions:
  - ecosystem: npm
  - language: javascript
  - moduleSystem: cjs
  - packageManager: npm@10.9.8
  - runtime: node@22.23.2

Rules:
  - One focused purpose; the smallest project that proves the goal.
  - Include a contract test (test/contract.*) that runs OFFLINE and exits 0 exactly when the goal behavior works.
  - Pin every dependency with a lockfile so resolution is reproducible.
  - No secrets, credentials, or tokens. No real URLs (only example.com or localhost). No absolute paths.
  - No personal names, emails, company names, or project identifiers of any kind.
  - No binaries and no generated output (node_modules, dist, target, venv, .git, .env).
  - Keep it under 200 files and 256KB packed.
csx.json
{"case":{"caseId":"case:sha256:e679dcece10406afdfacfc448d6f6fbf9166c1c07b74d798f2088b39301c4aa3","constraints":{"executionContext":"node"},"contract":["Type.Object creates an object schema with properties and required list","Type.Object excludes optional properties from the required list","Type.Object supports additionalProperties constraint option","Type.Object supports schema metadata options including title and description","Type.Object supports nested object schema compositions"],"goal":"verify Type.Object in pkg:npm/%40sinclair/typebox@0.27.12","kind":"HOW","packages":["pkg:npm/%40sinclair/typebox@0.27.12"],"schemaVersion":1,"symbols":["Type.Object"]},"contractCommand":["node","test/contract.cjs"],"environment":{"arch":"x64","distro":"ubuntu","ecosystem":"npm","executionContext":"node","language":"javascript","libc":"glibc","libcVersion":"2.39","moduleSystem":"cjs","os":"linux","osVersionBucket":"24","packageManager":"npm","packageManagerVersion":"10.9.8","runtime":"node","runtimeVersion":"22.23.2","schemaVersion":1},"license":"MIT-0","packages":["pkg:npm/%40sinclair/typebox@0.27.12"],"schemaVersion":1,"subject":"pkg:npm/%40sinclair/typebox@0.27.12","symbols":["Type.Object"],"verifierAdapter":"node-typescript@1"}
index.js
const { Type } = require('@sinclair/typebox');

/**
 * Creates an object schema representing a user profile with nested settings.
 */
function createUserSchema(options = {}) {
  return Type.Object(
    {
      id: Type.Number({ minimum: 1 }),
      username: Type.String({ minLength: 3 }),
      bio: Type.Optional(Type.String()),
      settings: Type.Object({
        theme: Type.String(),
        notifications: Type.Boolean()
      })
    },
    options
  );
}

module.exports = {
  Type,
  createUserSchema
};
package-lock.json
{
  "name": "sample-typebox-object",
  "version": "1.0.0",
  "lockfileVersion": 3,
  "requires": true,
  "packages": {
    "": {
      "name": "sample-typebox-object",
      "version": "1.0.0",
      "dependencies": {
        "@sinclair/typebox": "0.27.12"
      }
    },
    "node_modules/@sinclair/typebox": {
      "version": "0.27.12",
      "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.27.12.tgz",
      "integrity": "sha512-hhyNJ+nbR6ZR7pToHvllEFun9TL0sbL+tk/ON75lo+Xas054uez98qRbsuNt7MBCyZKK4+8Yli/OAGZhmfBZ/g==",
      "license": "MIT"
    }
  }
}
package.json
{
  "name": "sample-typebox-object",
  "version": "1.0.0",
  "private": true,
  "description": "Clean-room sample verifying Type.Object in @sinclair/typebox@0.27.12",
  "main": "index.js",
  "scripts": {
    "test": "node test/contract.cjs"
  },
  "dependencies": {
    "@sinclair/typebox": "0.27.12"
  }
}
spec.json
{
  "schemaVersion": 1,
  "goal": "verify Type.Object in pkg:npm/%40sinclair/typebox@0.27.12",
  "kind": "HOW",
  "packages": [
    "pkg:npm/%40sinclair/typebox@0.27.12"
  ],
  "symbols": [
    "Type.Object"
  ],
  "constraints": {
    "executionContext": "node"
  },
  "runtimeConditions": {
    "ecosystem": "npm",
    "language": "javascript",
    "moduleSystem": "cjs",
    "packageManager": "npm@10.9.8",
    "runtime": "node@22.23.2"
  }
}
test/contract.cjs
const assert = require('node:assert');
const { Type, createUserSchema } = require('../index.js');

// Assertion 1: Type.Object creates an object schema with properties and required list
const baseObject = Type.Object({
  id: Type.Number(),
  name: Type.String()
});
assert.strictEqual(baseObject.type, 'object');
assert.ok(baseObject.properties.id);
assert.strictEqual(baseObject.properties.id.type, 'number');
assert.ok(baseObject.properties.name);
assert.strictEqual(baseObject.properties.name.type, 'string');
assert.deepStrictEqual(baseObject.required, ['id', 'name']);

// Assertion 2: Type.Object excludes optional properties from the required list
const objectWithOptional = Type.Object({
  id: Type.Number(),
  nickname: Type.Optional(Type.String())
});
assert.strictEqual(objectWithOptional.type, 'object');
assert.ok(objectWithOptional.properties.nickname);
assert.deepStrictEqual(objectWithOptional.required, ['id']);

// Assertion 3: Type.Object supports additionalProperties constraint option
const closedObject = Type.Object(
  {
    key: Type.String()
  },
  { additionalProperties: false }
);
assert.strictEqual(closedObject.type, 'object');
assert.strictEqual(closedObject.additionalProperties, false);

// Assertion 4: Type.Object supports schema metadata options including title and description
const documentedObject = Type.Object(
  {
    title: Type.String()
  },
  {
    title: 'DocumentedEntity',
    description: 'An entity with documentation metadata'
  }
);
assert.strictEqual(documentedObject.type, 'object');
assert.strictEqual(documentedObject.title, 'DocumentedEntity');
assert.strictEqual(documentedObject.description, 'An entity with documentation metadata');

// Assertion 5: Type.Object supports nested object schema compositions
const userSchema = createUserSchema({ additionalProperties: false });
assert.strictEqual(userSchema.type, 'object');
assert.strictEqual(userSchema.additionalProperties, false);
assert.deepStrictEqual(userSchema.required, ['id', 'username', 'settings']);
assert.strictEqual(userSchema.properties.id.type, 'number');
assert.strictEqual(userSchema.properties.username.type, 'string');
assert.strictEqual(userSchema.properties.settings.type, 'object');
assert.deepStrictEqual(userSchema.properties.settings.required, ['theme', 'notifications']);

console.log('Contract tests passed successfully.');

Origin Seeder

anonymous