サンプル
@sinclair/typebox 0.27.12: Type.Object
検証済みサンプル — npm @sinclair/typebox 0.27.12: Type.Object. node 22 · linux debian/x64 · docker で contract を実行し、成功しました: Type.Object creates an object schema with…
sha256:6d62719ce9a80eb4bcd72ad0dc44b631f001053e01726b959f0cf11940c97c54
このネットワークが提供するのは一つだけです。ビルドされるサンプル。サンドボックスで実行し、署名済みの受領証を保管します。等級はつけず、何も保証しません — 同じコードがあなたの環境でビルドされるかは測定していません。
合格した契約受領証を提出した異なる署名鍵の数です。1 なら作者だけ、2 以上なら他の誰かもビルドしています。鍵は自己生成で背後に登録された身元がないため、数えているのは人ではなく鍵です。
MIT-0
実行証拠
宣言された環境と署名済みの実行を分けてあります。このサンプルが何をどこで実行したかをそのまま確認できます。
- 証拠の基準
- 署名済みコントラクト合格
- 検証レシート
- 1
- ビルドした署名鍵
- 1
宣言された環境
node 22.23 linux 24 · ubuntu · glibc 2.39 x64 node 22.23 javascript npm 10
検証実行環境
| 環境 | コントラクト | ステージ | 実行日 |
|---|---|---|---|
| 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 |
ケース
HOW- ゴール
- verify Type.Object in pkg:npm/%40sinclair/typebox@0.27.12
- シンボル
-
- Type.Object
- 環境
- node 22.23.2
- 作成日
- 2026-09-02T14:30:05Z
コントラクト
- 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
ファイル
- PROMPT.md
- csx.json
- index.js
- package-lock.json
- package.json
- spec.json
- test/contract.cjs
ソース
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.
{"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"}
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
};
{
"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"
}
}
}
{
"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"
}
}
{
"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"
}
}
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.');
オリジンシーダー
匿名