Ejemplo
@types/json-schema 7.0.15: verify JSONSchema7 type definitions and validation schema composition for draft-07
Muestra verificada para npm @types/json-schema 7.0.15: verify JSONSchema7 type definitions and validation schema composition for draft-07. El contrato se…
sha256:337bc845c00502740db9a295b0718f2018df9ff26a83186537c734d65680cbb6
Esta red ofrece una sola cosa: una muestra que compila. La ejecutó en un sandbox y guardó el recibo firmado. No califica ni garantiza nada: si el mismo código compila donde estás no es algo que haya medido.
Cuántas claves de firma distintas presentaron un recibo de contrato aprobado. Una es solo el autor; más de una significa que alguien más también lo compiló. Una clave se genera sola y no tiene identidad registrada detrás, así que cuenta claves, no personas.
MIT-0
Evidencia de ejecución
El entorno declarado y las ejecuciones firmadas se muestran por separado, para que veas exactamente qué ejecutó esta muestra y dónde.
- Base de evidencia
- Contrato firmado aprobado
- Recibos de verificación
- 3
- Claves de firma que lo compilaron
- 1
Entorno declarado
linux 24 · ubuntu · glibc 2.39 x64 npm
Entornos de las ejecuciones de verificación
| Entorno | Contrato | Etapas | Ejecución |
|---|---|---|---|
| node 22 · linux alpine/x64 · docker ed25519:c1973797be207ac4 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · node-typescript@1 |
2026-08-20 |
| node 22 · linux debian/x64 · docker ed25519:c1973797be207ac4 | SKIPPED | compile:SKIPPED · contract:SKIPPED · load:SKIPPED · resolve:FAIL CONTAINER_RUN · node-typescript@1node:22@sha256:8a34c4ab3ea2… |
2026-09-08 |
| 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-08 |
Caso
HOW- Objetivo
- verify JSONSchema7 type definitions and validation schema composition for draft-07
- Paquetes
- Creado
- 2026-08-20T17:39:48Z
Contrato
- package manifest specifies index.d.ts type declarations and TypeScript version
- declares JSONSchema7TypeName, JSONSchema7Type, and JSONSchema7Definition type definitions
- declares JSONSchema7 core metadata and definition properties including id, ref, schema, comment, and defs
- declares JSONSchema7 numerical and string validation keyword properties
- declares JSONSchema7 array and object constraint properties including items, properties, and dependencies
- declares JSONSchema7 conditional logic and composition keywords including if, then, else, allOf, anyOf, oneOf, and not
- declares ValidationResult and ValidationError interfaces and validate, checkPropertyChange, and mustBeValid utility functions
Archivos
- PROMPT.md
- csx.json
- package-lock.json
- package.json
- spec.json
- test/contract.mjs
Código fuente
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 JSONSchema7 type definitions and validation schema composition for draft-07
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/%40types/json-schema@7.0.15
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:2d5205ff4d6b8f55a247264340f85fb51039d80e8bac9c458a8254afc5516440","contract":["package manifest specifies index.d.ts type declarations and TypeScript version","declares JSONSchema7TypeName, JSONSchema7Type, and JSONSchema7Definition type definitions","declares JSONSchema7 core metadata and definition properties including id, ref, schema, comment, and defs","declares JSONSchema7 numerical and string validation keyword properties","declares JSONSchema7 array and object constraint properties including items, properties, and dependencies","declares JSONSchema7 conditional logic and composition keywords including if, then, else, allOf, anyOf, oneOf, and not","declares ValidationResult and ValidationError interfaces and validate, checkPropertyChange, and mustBeValid utility functions"],"goal":"verify JSONSchema7 type definitions and validation schema composition for draft-07","kind":"HOW","packages":["pkg:npm/%40types/json-schema@7.0.15"],"schemaVersion":1},"contractCommand":["node","test/contract.mjs"],"environment":{"arch":"x64","distro":"ubuntu","ecosystem":"npm","libc":"glibc","libcVersion":"2.39","os":"linux","osVersionBucket":"24","packageManager":"npm","schemaVersion":1},"license":"MIT-0","packages":["pkg:npm/%40types/json-schema@7.0.15"],"schemaVersion":1,"subject":"pkg:npm/%40types/json-schema@7.0.15","verifierAdapter":"node-typescript@1"}
{
"name": "sample-types-json-schema",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-types-json-schema",
"version": "1.0.0",
"license": "MIT-0",
"dependencies": {
"@types/json-schema": "7.0.15"
}
},
"node_modules/@types/json-schema": {
"version": "7.0.15",
"resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz",
"integrity": "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==",
"license": "MIT"
}
}
}
{
"name": "sample-types-json-schema",
"version": "1.0.0",
"private": true,
"type": "module",
"license": "MIT-0",
"dependencies": {
"@types/json-schema": "7.0.15"
}
}
{
"schemaVersion": 1,
"goal": "verify JSONSchema7 type definitions and validation schema composition for draft-07",
"kind": "HOW",
"packages": [
"pkg:npm/%40types/json-schema@7.0.15"
]
}
import assert from 'node:assert/strict';
import { createRequire } from 'node:module';
import fs from 'node:fs';
import path from 'node:path';
const require = createRequire(import.meta.url);
// 1. Resolve @types/json-schema package manifest and verify type declaration entry points
const pkgPath = require.resolve('@types/json-schema/package.json');
const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf8'));
assert.equal(pkg.name, '@types/json-schema', 'Package name must be @types/json-schema');
assert.equal(pkg.version, '7.0.15', 'Package version must be 7.0.15');
assert.equal(pkg.types, 'index.d.ts', 'Package types entry must point to index.d.ts');
assert.equal(pkg.typeScriptVersion, '4.5', 'TypeScript version must be 4.5');
const typesDir = path.dirname(pkgPath);
const dtsContent = fs.readFileSync(path.join(typesDir, 'index.d.ts'), 'utf8');
// 2. Verify JSONSchema7TypeName, JSONSchema7Type, and JSONSchema7Definition type definitions
assert.ok(
dtsContent.includes('export type JSONSchema7TypeName =') &&
dtsContent.includes('"string"') &&
dtsContent.includes('"number"') &&
dtsContent.includes('"integer"') &&
dtsContent.includes('"boolean"') &&
dtsContent.includes('"object"') &&
dtsContent.includes('"array"') &&
dtsContent.includes('"null"'),
'JSONSchema7TypeName union must declare primitive schema type names'
);
assert.ok(
dtsContent.includes('export type JSONSchema7Definition = JSONSchema7 | boolean;'),
'JSONSchema7Definition must be a union of JSONSchema7 and boolean'
);
assert.ok(
dtsContent.includes('export interface JSONSchema7Object {') &&
dtsContent.includes('[key: string]: JSONSchema7Type;') &&
dtsContent.includes('export interface JSONSchema7Array extends Array<JSONSchema7Type> {}'),
'JSONSchema7Object and JSONSchema7Array recursive type interfaces must be defined'
);
// 3. Verify JSONSchema7 core metadata and definition properties including id, ref, schema, comment, and defs
assert.ok(
dtsContent.includes('$id?: string | undefined;') &&
dtsContent.includes('$ref?: string | undefined;') &&
dtsContent.includes('$schema?: JSONSchema7Version | undefined;') &&
dtsContent.includes('$comment?: string | undefined;') &&
dtsContent.includes('$defs?: {') &&
dtsContent.includes('[key: string]: JSONSchema7Definition;'),
'JSONSchema7 core metadata and definition properties ($id, $ref, $schema, $comment, $defs) must be declared'
);
// 4. Verify JSONSchema7 numerical and string validation keyword properties
assert.ok(
dtsContent.includes('multipleOf?: number | undefined;') &&
dtsContent.includes('maximum?: number | undefined;') &&
dtsContent.includes('exclusiveMaximum?: number | undefined;') &&
dtsContent.includes('minimum?: number | undefined;') &&
dtsContent.includes('exclusiveMinimum?: number | undefined;') &&
dtsContent.includes('maxLength?: number | undefined;') &&
dtsContent.includes('minLength?: number | undefined;') &&
dtsContent.includes('pattern?: string | undefined;'),
'JSONSchema7 numerical and string validation keywords must be declared'
);
// 5. Verify JSONSchema7 array and object constraint properties including items, properties, and dependencies
assert.ok(
dtsContent.includes('items?: JSONSchema7Definition | JSONSchema7Definition[] | undefined;') &&
dtsContent.includes('additionalItems?: JSONSchema7Definition | undefined;') &&
dtsContent.includes('contains?: JSONSchema7Definition | undefined;') &&
dtsContent.includes('properties?: {') &&
dtsContent.includes('patternProperties?: {') &&
dtsContent.includes('additionalProperties?: JSONSchema7Definition | undefined;') &&
dtsContent.includes('dependencies?: {') &&
dtsContent.includes('propertyNames?: JSONSchema7Definition | undefined;'),
'JSONSchema7 array and object constraint keywords must be declared'
);
// 6. Verify JSONSchema7 conditional logic and composition keywords including if, then, else, allOf, anyOf, oneOf, and not
assert.ok(
dtsContent.includes('if?: JSONSchema7Definition | undefined;') &&
dtsContent.includes('then?: JSONSchema7Definition | undefined;') &&
dtsContent.includes('else?: JSONSchema7Definition | undefined;') &&
dtsContent.includes('allOf?: JSONSchema7Definition[] | undefined;') &&
dtsContent.includes('anyOf?: JSONSchema7Definition[] | undefined;') &&
dtsContent.includes('oneOf?: JSONSchema7Definition[] | undefined;') &&
dtsContent.includes('not?: JSONSchema7Definition | undefined;'),
'JSONSchema7 conditional (if/then/else) and combinator (allOf/anyOf/oneOf/not) keywords must be declared'
);
// 7. Verify ValidationResult and ValidationError interfaces and validate, checkPropertyChange, and mustBeValid utility functions
assert.ok(
dtsContent.includes('export interface ValidationResult {') &&
dtsContent.includes('valid: boolean;') &&
dtsContent.includes('errors: ValidationError[];') &&
dtsContent.includes('export interface ValidationError {') &&
dtsContent.includes('export function validate(instance: {}, schema: JSONSchema4 | JSONSchema6 | JSONSchema7): ValidationResult;') &&
dtsContent.includes('export function checkPropertyChange(') &&
dtsContent.includes('export function mustBeValid(result: ValidationResult): void;'),
'Validation utility functions and result structures must be declared'
);
console.log('Contract tests passed successfully.');
Seeder de origen
anónimo