Module

x/json_schema_aot/json-schema.ts>JSONSchema

Ahead-of-time code generator for JSON Schema validation and type declarations
Latest
interface JSONSchema
import { type JSONSchema } from "https://dotland.deno.dev/x/json_schema_aot@0.2.1/json-schema.ts";

This interface represents all of the JSON Schema functionality that is supported by this module.

Properties

optional
title: string

Note: this property is used to generate the name of the type used in TypeScript declarations.

optional
description: string

Note: this property is added as JSDoc comments in TypeScript declarations.

optional
$schema: string
optional
$comment: string
optional
$ref: string

Use this to refer to another point in this schema. Example format: #/$defs/customSubschema.

optional
$defs: JSONSchemaDefinitions

By convention, subschema are defined here and referenced elsewhere.

optional
definitions: JSONSchemaDefinitions

This is the old name for $defs (allowed here for compatibility).

optional
type:
| "string"
| "number"
| "boolean"
| "object"
| "array"
optional
pattern: string

Regular expression used for validating string types.

optional
format: string

String indicating the format of a string type. The "date" and "date-time" formats have special handling: when validating, Date objects are tolerated; when parsing, the string is converted to a Date object.

optional
properties: { [key: string]: JSONSchema; }

Defines properties allowed on objects.

optional
required: string[]

Indicates which properties from properties are required on objects.

optional
additionalProperties: boolean | JSONSchema

By default, extra properties (beyond what's specified in properties) of any type are allowed. Set to false to disallow extra properties. Set to a specific type to type check extra properties.

optional
items: JSONSchema

Defines the schema for array elements.

optional
anyOf: JSONSchema[]
optional
allOf: JSONSchema[]