Skip to content

Reference / SDK

JSON Schemas

The zod schemas behind every --json result, and the functions that turn them into the published JSON Schema documents.

Available from 0.12.0

Every result the CLI prints under --json has a zod 4 schema in the SDK, pinned at compile time to the TypeScript type it describes: the same fields, the same optional fields and the same value types, so a change to one without the other fails the build. Its parse also accepts a value from a newer verbatra: it allows fields it does not list and strips them from the result. The same schemas are published as JSON Schema documents; their URLs and the versioning rule are on Exit codes and JSON output.

Result schemas

runSummarySchema

Describes a RunSummary, the result of translate, watch and import. Published as run-summary.json.

Signature
const runSummarySchema: z.ZodObject<{ ... }, z.core.$strip>;

checkSummarySchema

Describes a CheckSummary, the result of check. Published as check-summary.json.

Signature
const checkSummarySchema: z.ZodObject<{ ... }, z.core.$strip>;

checkFileSummarySchema

Describes a CheckFileSummary, the result of checkFile. Published as check-file-summary.json.

Signature
const checkFileSummarySchema: z.ZodObject<{ ... }, z.core.$strip>;

diffSummarySchema

Describes a DiffSummary, the result of diff. Published as diff-summary.json.

Signature
const diffSummarySchema: z.ZodObject<{ ... }, z.core.$strip>;

doctorResultSchema

Describes a DoctorResult, the result of doctor. Its dataFlow field is dataFlowManifestSchema, so doctor-result.json refers to data-flow-manifest.json instead of repeating it.

Signature
const doctorResultSchema: z.ZodObject<{ ... }, z.core.$strip>;

provenanceReportResultSchema

Describes a ProvenanceReportResult, the result of provenanceReport, including the available: false variant. Published as provenance-report.json.

Signature
const provenanceReportResultSchema: z.ZodUnion<readonly [...]>;

pseudolocalizeResultSchema

Describes a PseudolocalizeResult, the result of pseudolocalize. Published as pseudolocalize-result.json.

Signature
const pseudolocalizeResultSchema: z.ZodObject<{ ... }, z.core.$strip>;

generateTypesResultSchema

Describes a GenerateTypesResult, the result of generateTypes. Published as generate-types-result.json.

Signature
const generateTypesResultSchema: z.ZodObject<{ ... }, z.core.$strip>;

extractResultSchema

Describes an ExtractResult, the result of extract. Published as extract-result.json.

Signature
const extractResultSchema: z.ZodObject<{ ... }, z.core.$strip>;

exportWorkbookResultSchema

Describes an ExportWorkbookResult, the result of exportWorkbook. Published as export-workbook-result.json.

Signature
const exportWorkbookResultSchema: z.ZodObject<{ ... }, z.core.$strip>;

importTmxResultSchema

Describes an ImportTmxResult, the result of importTmx. Published as import-tmx-result.json.

Signature
const importTmxResultSchema: z.ZodObject<{ ... }, z.core.$strip>;

exportTmxResultSchema

Describes an ExportTmxResult, the result of exportTmx. Published as export-tmx-result.json.

Signature
const exportTmxResultSchema: z.ZodObject<{ ... }, z.core.$strip>;

Shared schemas

localeSummarySchema

Describes a LocaleSummary, one entry of a run summary's locales.

Signature
const localeSummarySchema: z.ZodObject<{ ... }, z.core.$strip>;

keyProvenanceSchema

Describes a KeyProvenance, the recorded origin and review state of one key.

Signature
const keyProvenanceSchema: z.ZodObject<{ ... }, z.core.$strip>;

provenanceSummarySchema

Describes a ProvenanceSummary, the key counts per origin and per review state a locale of check carries.

Signature
const provenanceSummarySchema: z.ZodObject<{ ... }, z.core.$strip>;

keyOriginSchema

Describes a KeyOrigin: who or what wrote a key's current value.

Signature
const keyOriginSchema: z.ZodEnum<{ ... }>;

Stream records

progressEventSchema

Describes a ProgressEvent, what onProgress receives. The CLI prints some of these events to stderr under --json. Published as progress-event.json.

Signature
const progressEventSchema: z.ZodUnion<readonly [...]>;

lockWaitEventSchema

Describes a LockWaitEvent, what onLockWait receives while a run waits for a locale's write lock. The CLI prints it to stderr with type: "lock-wait" added. Published as lock-wait-event.json.

Signature
const lockWaitEventSchema: z.ZodObject<{ ... }, z.core.$strip>;

Publishing

SDK_JSON_SCHEMAS lists every document the SDK publishes under @verbatra/sdk/schemas/, each with its name, title, io and zod schema. JSON_SCHEMA_BASE_URL is https://verbatra.kreitz-webdev.de/schema/v1/. KNOWN_ERROR_CODES lists every SDK, provider and adapter error code; the error envelope schema offers them as a hint while accepting any code.

renderJsonSchemas

Generates verbatra's own JSON Schema documents (draft 2020-12) from a list of JsonSchemaDocuments, keyed by name. Each one gets the $id that jsonSchemaUrl gives its name, a URL on this site, so use it for verbatra's documents only and renderOutputJsonSchema for a schema of your own. An output document allows every property it does not list; an input document, such as the config, keeps its closed objects. A schema that embeds a document from either list refers to it by URL.

Signature
function renderJsonSchemas(
  documents: readonly JsonSchemaDocument[],
  references?: readonly JsonSchemaDocument[],
): Readonly<Record<string, JsonSchemaObject>>;

Returns: one document per entry of documents, each with $schema, $id and title.

renderOutputJsonSchema

Generates the JSON Schema of one zod schema the way the output documents are generated, without an $id, such as for an MCP tool's outputSchema.

Signature
function renderOutputJsonSchema(schema: z.ZodType): JsonSchemaObject;

Returns: JsonSchemaObject

jsonSchemaUrl

Returns the public URL of a published document, which is also its $id: jsonSchemaUrl("run-summary") is https://verbatra.kreitz-webdev.de/schema/v1/run-summary.json.

Signature
function jsonSchemaUrl(name: string): string;

Returns: string

Edit on GitHub

On this page