Beispiel
json-schema-typed 8.0.2
Verifiziertes Beispiel für npm json-schema-typed 8.0.2. Der Vertrag lief auf node 22 · linux alpine/x64 · docker und bestand: draft and $schema constants…
sha256:7d0dfe5064d7812ac71bb6ef49480d9880f3c76150ea6273efd2a80295349b16
Dieses Netzwerk bietet eine Sache: ein Sample, das baut. Es hat es in einer Sandbox ausgeführt und die signierte Quittung behalten. Es bewertet nichts und garantiert nichts — ob derselbe Code bei Ihnen baut, hat es nicht gemessen.
Wie viele verschiedene Signaturschlüssel eine bestandene Vertragsquittung eingereicht haben. Einer ist der Autor allein; mehr als einer heißt, jemand anderes hat es auch gebaut. Ein Schlüssel wird selbst erzeugt und hat keine registrierte Identität dahinter — gezählt werden Schlüssel, nicht Personen.
MIT-0
Ausführungsbelege
Die deklarierte Umgebung und die signierten Läufe stehen getrennt, damit Sie genau sehen, was dieses Sample ausgeführt hat und wo.
- Beleggrundlage
- Signierter Vertrag bestanden
- Verifizierungsbelege
- 1
- Signaturschlüssel, die es gebaut haben
- 1
Deklarierte Umgebung
node 22.23 linux 24 · ubuntu · glibc 2.39 x64 node 22.23 javascript npm 10
Umgebungen der Verifizierungsläufe
| Umgebung | Contract | Stufen | Lauf |
|---|---|---|---|
| node 22 · linux alpine/x64 · docker ed25519:c1973797be207ac4 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · node-typescript@1node:22-alpine@sha256:c610fcdfb1d5… |
2026-08-27 |
Fall
HOW- Ziel
- verify pkg:npm/json-schema-typed@8.0.2
- Pakete
- Umgebung
- node 22.23.2
- Erstellt
- 2026-08-27T21:57:59Z
Contract
- draft and $schema constants match JSON Schema Draft 2020-12 meta-schema URI
- TypeName enum exports standard JSON schema primitive types
- Format enum exports standard string format specifiers including email, uri, and date-time
- ContentEncoding enum exports media content encoding strategies including base64
- keywords list contains standard draft-2020-12 validation and applicator keywords
- draft-07 and draft-2019-09 subpath exports provide draft-specific meta-schemas and constants
- schema builder functions construct structured schema definitions with format and encoding constraints
Dateien
- PROMPT.md
- csx.json
- package-lock.json
- package.json
- spec.json
- src/index.mjs
- test/contract.mjs
Quelltext
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 pkg:npm/json-schema-typed@8.0.2
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/json-schema-typed@8.0.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:0c4ccdf5467187dced4c9d295064bb2f743adf4f7525f740f0e0167c3152754e","contract":["draft and $schema constants match JSON Schema Draft 2020-12 meta-schema URI","TypeName enum exports standard JSON schema primitive types","Format enum exports standard string format specifiers including email, uri, and date-time","ContentEncoding enum exports media content encoding strategies including base64","keywords list contains standard draft-2020-12 validation and applicator keywords","draft-07 and draft-2019-09 subpath exports provide draft-specific meta-schemas and constants","schema builder functions construct structured schema definitions with format and encoding constraints"],"goal":"verify pkg:npm/json-schema-typed@8.0.2","kind":"HOW","packages":["pkg:npm/json-schema-typed@8.0.2"],"schemaVersion":1},"contractCommand":["node","test/contract.mjs"],"environment":{"arch":"x64","distro":"ubuntu","ecosystem":"npm","executionContext":"node","language":"javascript","libc":"glibc","libcVersion":"2.39","moduleSystem":"esm","os":"linux","osVersionBucket":"24","packageManager":"npm","packageManagerVersion":"10.9.8","runtime":"node","runtimeVersion":"22.23.2","schemaVersion":1},"license":"MIT-0","packages":["pkg:npm/json-schema-typed@8.0.2"],"schemaVersion":1,"subject":"pkg:npm/json-schema-typed@8.0.2","verifierAdapter":"node-typescript@1"}
{
"name": "sample-json-schema-typed",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-json-schema-typed",
"version": "1.0.0",
"license": "MIT-0",
"dependencies": {
"json-schema-typed": "8.0.2"
}
},
"node_modules/json-schema-typed": {
"version": "8.0.2",
"resolved": "https://registry.npmjs.org/json-schema-typed/-/json-schema-typed-8.0.2.tgz",
"integrity": "sha512-fQhoXdcvc3V28x7C7BMs4P5+kNlgUURe2jmUT1T//oBRMDrqy1QPelJimwZGo7Hg9VPV3EQV5Bnq4hbFy2vetA==",
"license": "BSD-2-Clause"
}
}
}
{
"name": "sample-json-schema-typed",
"version": "1.0.0",
"private": true,
"type": "module",
"license": "MIT-0",
"dependencies": {
"json-schema-typed": "8.0.2"
}
}
{
"schemaVersion": 1,
"goal": "verify pkg:npm/json-schema-typed@8.0.2",
"kind": "HOW",
"packages": [
"pkg:npm/json-schema-typed@8.0.2"
]
}
import { draft, $schema, Format, TypeName, ContentEncoding, keywords } from "json-schema-typed";
import * as draft07 from "json-schema-typed/draft-07";
import * as draft201909 from "json-schema-typed/draft-2019-09";
import * as draft202012 from "json-schema-typed/draft-2020-12";
export function createObjectSchema(properties = {}, required = []) {
return {
$schema,
type: TypeName.Object,
properties,
required,
};
}
export function createStringProperty(format = null, minLength = 0, maxLength = undefined) {
const schema = {
type: TypeName.String,
minLength,
};
if (format) {
schema.format = format;
}
if (maxLength !== undefined) {
schema.maxLength = maxLength;
}
return schema;
}
export function createMediaSchema(mediaType, encoding = ContentEncoding.Base64) {
return {
type: TypeName.String,
contentMediaType: mediaType,
contentEncoding: encoding,
};
}
export function createArraySchema(itemsSchema, minItems = 0, uniqueItems = false) {
return {
type: TypeName.Array,
items: itemsSchema,
minItems,
uniqueItems,
};
}
export function getDraftMeta(version) {
switch (version) {
case "draft-07":
return { draft: draft07.draft, $schema: draft07.$schema };
case "draft-2019-09":
return { draft: draft201909.draft, $schema: draft201909.$schema };
case "draft-2020-12":
default:
return { draft: draft202012.draft, $schema: draft202012.$schema };
}
}
export function isSupportedKeyword(keyword) {
return keywords.includes(keyword);
}
export { draft, $schema, Format, TypeName, ContentEncoding, keywords };
import assert from "node:assert/strict";
import {
draft,
$schema,
Format,
TypeName,
ContentEncoding,
keywords,
createObjectSchema,
createStringProperty,
createMediaSchema,
createArraySchema,
getDraftMeta,
isSupportedKeyword
} from "../src/index.mjs";
// Test 1: draft and $schema constants match JSON Schema Draft 2020-12 meta-schema URI
{
assert.equal(draft, "2020-12");
assert.equal($schema, "https://json-schema.org/draft/2020-12/schema");
}
// Test 2: TypeName enum exports standard JSON schema primitive types
{
assert.equal(TypeName.Array, "array");
assert.equal(TypeName.Boolean, "boolean");
assert.equal(TypeName.Integer, "integer");
assert.equal(TypeName.Null, "null");
assert.equal(TypeName.Number, "number");
assert.equal(TypeName.Object, "object");
assert.equal(TypeName.String, "string");
}
// Test 3: Format enum exports standard string format specifiers including email, uri, and date-time
{
assert.equal(Format.Date, "date");
assert.equal(Format.DateTime, "date-time");
assert.equal(Format.Duration, "duration");
assert.equal(Format.Email, "email");
assert.equal(Format.Hostname, "hostname");
assert.equal(Format.IDNEmail, "idn-email");
assert.equal(Format.IDNHostname, "idn-hostname");
assert.equal(Format.IPv4, "ipv4");
assert.equal(Format.IPv6, "ipv6");
assert.equal(Format.IRI, "iri");
assert.equal(Format.IRIReference, "iri-reference");
assert.equal(Format.JSONPointer, "json-pointer");
assert.equal(Format.JSONPointerURIFragment, "json-pointer-uri-fragment");
assert.equal(Format.RegEx, "regex");
assert.equal(Format.RelativeJSONPointer, "relative-json-pointer");
assert.equal(Format.Time, "time");
assert.equal(Format.URI, "uri");
assert.equal(Format.URIReference, "uri-reference");
assert.equal(Format.URITemplate, "uri-template");
assert.equal(Format.UUID, "uuid");
}
// Test 4: ContentEncoding enum exports media content encoding strategies including base64
{
assert.equal(ContentEncoding["7bit"], "7bit");
assert.equal(ContentEncoding["8bit"], "8bit");
assert.equal(ContentEncoding.Base64, "base64");
assert.equal(ContentEncoding.Binary, "binary");
assert.equal(ContentEncoding.IETFToken, "ietf-token");
assert.equal(ContentEncoding.QuotedPrintable, "quoted-printable");
assert.equal(ContentEncoding.XToken, "x-token");
}
// Test 5: keywords list contains standard draft-2020-12 validation and applicator keywords
{
assert.equal(Array.isArray(keywords), true);
assert.ok(isSupportedKeyword("$anchor"));
assert.ok(isSupportedKeyword("$comment"));
assert.ok(isSupportedKeyword("$defs"));
assert.ok(isSupportedKeyword("$dynamicAnchor"));
assert.ok(isSupportedKeyword("$dynamicRef"));
assert.ok(isSupportedKeyword("$id"));
assert.ok(isSupportedKeyword("$ref"));
assert.ok(isSupportedKeyword("$schema"));
assert.ok(isSupportedKeyword("properties"));
assert.ok(isSupportedKeyword("required"));
assert.ok(isSupportedKeyword("type"));
assert.ok(isSupportedKeyword("prefixItems"));
assert.ok(isSupportedKeyword("unevaluatedProperties"));
assert.equal(isSupportedKeyword("nonExistentKeyword"), false);
}
// Test 6: draft-07 and draft-2019-09 subpath exports provide draft-specific meta-schemas and constants
{
const d7 = getDraftMeta("draft-07");
assert.equal(d7.draft, "7");
assert.equal(d7.$schema, "https://json-schema.org/draft-07/schema");
const d19 = getDraftMeta("draft-2019-09");
assert.equal(d19.draft, "2019-09");
assert.equal(d19.$schema, "https://json-schema.org/draft/2019-09/schema");
const d20 = getDraftMeta("draft-2020-12");
assert.equal(d20.draft, "2020-12");
assert.equal(d20.$schema, "https://json-schema.org/draft/2020-12/schema");
}
// Test 7: schema builder functions construct structured schema definitions with format and encoding constraints
{
const userSchema = createObjectSchema({
id: createStringProperty(Format.UUID),
email: createStringProperty(Format.Email),
homepage: createStringProperty(Format.URI),
createdAt: createStringProperty(Format.DateTime),
avatar: createMediaSchema("image/png", ContentEncoding.Base64),
tags: createArraySchema(createStringProperty(), 1, true)
}, ["id", "email"]);
assert.equal(userSchema.$schema, "https://json-schema.org/draft/2020-12/schema");
assert.equal(userSchema.type, "object");
assert.deepEqual(userSchema.required, ["id", "email"]);
assert.equal(userSchema.properties.id.type, "string");
assert.equal(userSchema.properties.id.format, "uuid");
assert.equal(userSchema.properties.email.type, "string");
assert.equal(userSchema.properties.email.format, "email");
assert.equal(userSchema.properties.homepage.type, "string");
assert.equal(userSchema.properties.homepage.format, "uri");
assert.equal(userSchema.properties.createdAt.type, "string");
assert.equal(userSchema.properties.createdAt.format, "date-time");
assert.equal(userSchema.properties.avatar.type, "string");
assert.equal(userSchema.properties.avatar.contentMediaType, "image/png");
assert.equal(userSchema.properties.avatar.contentEncoding, "base64");
assert.equal(userSchema.properties.tags.type, "array");
assert.equal(userSchema.properties.tags.items.type, "string");
assert.equal(userSchema.properties.tags.minItems, 1);
assert.equal(userSchema.properties.tags.uniqueItems, true);
}
console.log("All json-schema-typed contract tests passed successfully.");
Ursprungs-Seeder
anonym