(
document: JsonSchema.MultiDocument<"draft-2020-12">,
options?: {
readonly onEnter?:
| ((js: JsonSchema.JsonSchema) => JsonSchema.JsonSchema)
| undefined
}
): MultiDocumentParses a Draft 2020-12 JSON Schema multi-document into a MultiDocument.
When to use
Use when you need to import a Draft 2020-12 JSON Schema multi-document whose schemas share definitions.
Details
options.onEnter is an optional hook called on each JSON Schema node before
processing.
Gotchas
JSON Schema import is best-effort. Some JSON Schema constructs do not map
exactly to Effect schema representations, and importing schemas previously
emitted by toJsonSchemaMultiDocument may produce equivalent approximations
rather than the original representation shapes.
This throws if a $ref cannot be resolved.
export function function fromJsonSchemaMultiDocument(
document: JsonSchema.MultiDocument<"draft-2020-12">,
options?: {
readonly onEnter?:
| ((
js: JsonSchema.JsonSchema
) => JsonSchema.JsonSchema)
| undefined
}
): MultiDocument
Parses a Draft 2020-12 JSON Schema multi-document into a
When to use
Use when you need to import a Draft 2020-12 JSON Schema multi-document whose
schemas share definitions.
Details
options.onEnter is an optional hook called on each JSON Schema node before
processing.
Gotchas
JSON Schema import is best-effort. Some JSON Schema constructs do not map
exactly to Effect schema representations, and importing schemas previously
emitted by toJsonSchemaMultiDocument may produce equivalent approximations
rather than the original representation shapes.
This throws if a $ref cannot be resolved.
fromJsonSchemaMultiDocument(document: JsonSchema.MultiDocument<"draft-2020-12">(parameter) document: {
dialect: D;
schemas: readonly [JsonSchema, ...Array<JsonSchema>];
definitions: Definitions;
}
document: import JsonSchemaJsonSchema.type JsonSchema.MultiDocument = /*unresolved*/ anyMultiDocument<"draft-2020-12">, options: {
readonly onEnter?:
| ((
js: JsonSchema.JsonSchema
) => JsonSchema.JsonSchema)
| undefined
}
options?: {
readonly onEnter?: | ((
js: JsonSchema.JsonSchema
) => JsonSchema.JsonSchema)
| undefined
onEnter?: ((js: JsonSchema.JsonSchemajs: import JsonSchemaJsonSchema.type JsonSchema.JsonSchema = /*unresolved*/ anyJsonSchema) => import JsonSchemaJsonSchema.type JsonSchema.JsonSchema = /*unresolved*/ anyJsonSchema) | undefined
}): type MultiDocument = {
readonly representations: readonly [
Representation,
...Array<Representation>
]
readonly references: References
}
One or more
Representation
s sharing a common
References
map.
When to use
Use when you use
fromASTs
to create this from multiple Schema ASTs,
toCodeDocument
to generate TypeScript code, and
toJsonSchemaMultiDocument
to convert to JSON Schema.
MultiDocument {
let let definitionIdentifier:
| string
| undefined
definitionIdentifier: string | undefined
const const references: Record<
string,
Representation
>
references: type Record<K extends keyof any, T> = {
[P in K]: T
}
Construct a type with a set of properties K of type T
Record<string, type Representation =
| Declaration
| Reference
| Suspend
| Null
| Undefined
| Void
| Never
| Unknown
| Any
| String
| Number
| Boolean
| BigInt
| Symbol
| Literal
| UniqueSymbol
| ObjectKeyword
| Enum
| TemplateLiteral
| Arrays
| Objects
| Union
The core tagged union of all supported schema shapes.
Details
Each variant has a _tag discriminator. Switch on _tag to handle each
shape. Most variants carry optional annotations and some carry checks
for validation constraints.
Representation> = {}
type type ResolvedReference =
| Declaration
| Suspend
| Null
| Undefined
| Void
| Never
| Unknown
| Any
| String
| Number
| Boolean
| BigInt
| Symbol
| Literal
| UniqueSymbol
| ObjectKeyword
| Enum
| TemplateLiteral
| Arrays
| Objects
| Union
ResolvedReference = type Exclude<T, U> = T extends U
? never
: T
Exclude from T those types that are assignable to U
Exclude<type Representation =
| Declaration
| Reference
| Suspend
| Null
| Undefined
| Void
| Never
| Unknown
| Any
| String
| Number
| Boolean
| BigInt
| Symbol
| Literal
| UniqueSymbol
| ObjectKeyword
| Enum
| TemplateLiteral
| Arrays
| Objects
| Union
The core tagged union of all supported schema shapes.
Details
Each variant has a _tag discriminator. Switch on _tag to handle each
shape. Most variants carry optional annotations and some carry checks
for validation constraints.
Representation, { _tag: "Reference"_tag: "Reference" }>
const const resolvedReferences: Map<
string,
| Declaration
| Suspend
| Null
| Undefined
| Void
| Never
| Unknown
| Any
| String
| Number
| Boolean
| BigInt
| Symbol
| Literal
| UniqueSymbol
| ObjectKeyword
| Enum
| TemplateLiteral
| Arrays
| Objects
| Union
| null
>
resolvedReferences = new var Map: MapConstructor
new <string, Declaration | Suspend | Null | Undefined | Void | Never | Unknown | Any | String | Number | Boolean | BigInt | Symbol | Literal | UniqueSymbol | ObjectKeyword | Enum | TemplateLiteral | Arrays | Objects | Union | null>(iterable?: Iterable<readonly [string, Declaration | Suspend | Null | Undefined | Void | ... 16 more ... | null]> | null | undefined) => Map<...> (+3 overloads)
Map<string, type ResolvedReference =
| Declaration
| Suspend
| Null
| Undefined
| Void
| Never
| Unknown
| Any
| String
| Number
| Boolean
| BigInt
| Symbol
| Literal
| UniqueSymbol
| ObjectKeyword
| Enum
| TemplateLiteral
| Arrays
| Objects
| Union
ResolvedReference | null>()
function function (local function) resolveReference($ref: string): Declaration | Suspend | Null | Undefined | Void | Never | Unknown | Any | String | Number | Boolean | BigInt | Symbol | Literal | UniqueSymbol | ObjectKeyword | Enum | TemplateLiteral | Arrays | Objects | UnionresolveReference($ref: string$ref: string): type ResolvedReference =
| Declaration
| Suspend
| Null
| Undefined
| Void
| Never
| Unknown
| Any
| String
| Number
| Boolean
| BigInt
| Symbol
| Literal
| UniqueSymbol
| ObjectKeyword
| Enum
| TemplateLiteral
| Arrays
| Objects
| Union
ResolvedReference {
const const definition: JsonSchema.JsonSchemadefinition = document: JsonSchema.MultiDocument<"draft-2020-12">(parameter) document: {
dialect: D;
schemas: readonly [JsonSchema, ...Array<JsonSchema>];
definitions: Definitions;
}
document.definitions[$ref: string$ref]
if (const definition: JsonSchema.JsonSchemadefinition === var undefinedundefined) {
throw new var Error: ErrorConstructor
new (message?: string, options?: ErrorOptions) => Error (+1 overload)
Error(`Reference ${$ref: string$ref} not found`)
}
const const resolved:
| Declaration
| Suspend
| Null
| Undefined
| Void
| Never
| Unknown
| Any
| String
| Number
| Boolean
| BigInt
| Symbol
| Literal
| UniqueSymbol
| ObjectKeyword
| Enum
| TemplateLiteral
| Arrays
| Objects
| Union
| null
| undefined
resolved = const resolvedReferences: Map<
string,
| Declaration
| Suspend
| Null
| Undefined
| Void
| Never
| Unknown
| Any
| String
| Number
| Boolean
| BigInt
| Symbol
| Literal
| UniqueSymbol
| ObjectKeyword
| Enum
| TemplateLiteral
| Arrays
| Objects
| Union
| null
>
resolvedReferences.Map<string, Declaration | Suspend | Null | Undefined | Void | Never | Unknown | Any | String | ... 12 more ... | null>.get(key: string): Declaration | Suspend | Null | Undefined | Void | Never | Unknown | Any | String | Number | Boolean | BigInt | Symbol | Literal | UniqueSymbol | ObjectKeyword | Enum | TemplateLiteral | Arrays | Objects | Union | null | undefinedReturns a specified element from the Map object. If the value that is associated to the provided key is an object, then you will get a reference to that object and any change made to that object will effectively modify it inside the Map.
get($ref: string$ref)
if (const resolved:
| Declaration
| Suspend
| Null
| Undefined
| Void
| Never
| Unknown
| Any
| String
| Number
| Boolean
| BigInt
| Symbol
| Literal
| UniqueSymbol
| ObjectKeyword
| Enum
| TemplateLiteral
| Arrays
| Objects
| Union
| null
| undefined
resolved === null) {
throw new var Error: ErrorConstructor
new (message?: string, options?: ErrorOptions) => Error (+1 overload)
Error(`Circular reference detected: ${$ref: string$ref}`)
}
if (const resolved:
| Declaration
| Suspend
| Null
| Undefined
| Void
| Never
| Unknown
| Any
| String
| Number
| Boolean
| BigInt
| Symbol
| Literal
| UniqueSymbol
| ObjectKeyword
| Enum
| TemplateLiteral
| Arrays
| Objects
| Union
| undefined
resolved !== var undefinedundefined) return const resolved:
| Declaration
| Suspend
| Null
| Undefined
| Void
| Never
| Unknown
| Any
| String
| Number
| Boolean
| BigInt
| Symbol
| Literal
| UniqueSymbol
| ObjectKeyword
| Enum
| TemplateLiteral
| Arrays
| Objects
| Union
resolved
const resolvedReferences: Map<
string,
| Declaration
| Suspend
| Null
| Undefined
| Void
| Never
| Unknown
| Any
| String
| Number
| Boolean
| BigInt
| Symbol
| Literal
| UniqueSymbol
| ObjectKeyword
| Enum
| TemplateLiteral
| Arrays
| Objects
| Union
| null
>
resolvedReferences.Map<string, Declaration | Suspend | Null | Undefined | Void | Never | Unknown | Any | String | ... 12 more ... | null>.set(key: string, value: Declaration | Suspend | Null | Undefined | Void | Never | Unknown | Any | String | Number | Boolean | BigInt | Symbol | Literal | UniqueSymbol | ObjectKeyword | Enum | TemplateLiteral | Arrays | Objects | Union | null): Map<string, Declaration | Suspend | Null | Undefined | ... 17 more ... | null>Adds a new element with a specified key and value to the Map. If an element with the same key already exists, the element will be updated.
set($ref: string$ref, null)
const const value: Representationvalue = function (local function) recur(u: unknown): Representationrecur(const definition: JsonSchema.JsonSchemadefinition)
const const out:
| Declaration
| Suspend
| Null
| Undefined
| Void
| Never
| Unknown
| Any
| String
| Number
| Boolean
| BigInt
| Symbol
| Literal
| UniqueSymbol
| ObjectKeyword
| Enum
| TemplateLiteral
| Arrays
| Objects
| Union
out = const value: Representationvalue._tag: | "Declaration"
| "Suspend"
| "Reference"
| "Null"
| "Undefined"
| "Void"
| "Never"
| "Unknown"
| "Any"
| "String"
| "Number"
| "Boolean"
| "BigInt"
| "Symbol"
| "Literal"
| "UniqueSymbol"
| "ObjectKeyword"
| "Enum"
| "TemplateLiteral"
| "Arrays"
| "Objects"
| "Union"
_tag === "Reference" ? function (local function) resolveReference($ref: string): Declaration | Suspend | Null | Undefined | Void | Never | Unknown | Any | String | Number | Boolean | BigInt | Symbol | Literal | UniqueSymbol | ObjectKeyword | Enum | TemplateLiteral | Arrays | Objects | UnionresolveReference(const value: Referenceconst value: {
_tag: "Reference";
$ref: string;
}
value.Reference.$ref: string$ref) : const value:
| Declaration
| Suspend
| Null
| Undefined
| Void
| Never
| Unknown
| Any
| String
| Number
| Boolean
| BigInt
| Symbol
| Literal
| UniqueSymbol
| ObjectKeyword
| Enum
| TemplateLiteral
| Arrays
| Objects
| Union
value
const resolvedReferences: Map<
string,
| Declaration
| Suspend
| Null
| Undefined
| Void
| Never
| Unknown
| Any
| String
| Number
| Boolean
| BigInt
| Symbol
| Literal
| UniqueSymbol
| ObjectKeyword
| Enum
| TemplateLiteral
| Arrays
| Objects
| Union
| null
>
resolvedReferences.Map<string, Declaration | Suspend | Null | Undefined | Void | Never | Unknown | Any | String | ... 12 more ... | null>.set(key: string, value: Declaration | Suspend | Null | Undefined | Void | Never | Unknown | Any | String | Number | Boolean | BigInt | Symbol | Literal | UniqueSymbol | ObjectKeyword | Enum | TemplateLiteral | Arrays | Objects | Union | null): Map<string, Declaration | Suspend | Null | Undefined | ... 17 more ... | null>Adds a new element with a specified key and value to the Map. If an element with the same key already exists, the element will be updated.
set($ref: string$ref, const out:
| Declaration
| Suspend
| Null
| Undefined
| Void
| Never
| Unknown
| Any
| String
| Number
| Boolean
| BigInt
| Symbol
| Literal
| UniqueSymbol
| ObjectKeyword
| Enum
| TemplateLiteral
| Arrays
| Objects
| Union
out)
return const out:
| Declaration
| Suspend
| Null
| Undefined
| Void
| Never
| Unknown
| Any
| String
| Number
| Boolean
| BigInt
| Symbol
| Literal
| UniqueSymbol
| ObjectKeyword
| Enum
| TemplateLiteral
| Arrays
| Objects
| Union
out
}
for (const [const identifier: stringidentifier, const definition: JsonSchema.JsonSchemadefinition] of var Object: ObjectConstructorProvides functionality common to all JavaScript objects.
Object.ObjectConstructor.entries<unknown>(o: {
[s: string]: unknown;
} | ArrayLike<unknown>): [string, unknown][] (+1 overload)
Returns an array of key/values of the enumerable own properties of an object
entries(document: JsonSchema.MultiDocument<"draft-2020-12">(parameter) document: {
dialect: D;
schemas: readonly [JsonSchema, ...Array<JsonSchema>];
definitions: Definitions;
}
document.definitions)) {
let definitionIdentifier:
| string
| undefined
definitionIdentifier = const identifier: stringidentifier
const references: Record<
string,
Representation
>
references[const identifier: stringidentifier] = function (local function) unknownToJson(representation: Representation): RepresentationunknownToJson(function (local function) recur(u: unknown): Representationrecur(const definition: JsonSchema.JsonSchemadefinition))
}
let definitionIdentifier:
| string
| undefined
definitionIdentifier = var undefinedundefined
const const representations: anyconst representations: {
0: Representation;
length: number;
toString: () => string;
toLocaleString: { (): string; (locales: string | string[], options?: Intl.NumberFormatOptions & Intl.DateTimeFormatOptions): string };
pop: () => Representation | undefined;
push: (...items: Array<Representation>) => number;
concat: { (...items: Array<ConcatArray<Representation>>): Array<Representation>; (...items: Array<Representation | ConcatArray<Representation>>): Array<Representation> };
join: (separator?: string) => string;
reverse: () => Array<Representation>;
shift: () => Representation | undefined;
slice: (start?: number, end?: number) => Array<Representation>;
sort: (compareFn?: ((a: Representation, b: Representation) => number) | undefined) => [Representation, ...Representation[]];
splice: { (start: number, deleteCount?: number): Array<Representation>; (start: number, deleteCount: number, ...items: Array<Representation>): Array<Representation> };
unshift: (...items: Array<Representation>) => number;
indexOf: (searchElement: Representation, fromIndex?: number) => number;
lastIndexOf: (searchElement: Representation, fromIndex?: number) => number;
every: { (predicate: (value: Representation, index: number, array: Array<Representation>) => value is S, thisArg?: any): this is S[]; (predicate: (value: Representation, index: number, array: Array<Representation>) => unknown, thisArg?: any): boo…;
some: (predicate: (value: Representation, index: number, array: Array<Representation>) => unknown, thisArg?: any) => boolean;
forEach: (callbackfn: (value: Representation, index: number, array: Array<Representation>) => void, thisArg?: any) => void;
map: (callbackfn: (value: Representation, index: number, array: Array<Representation>) => U, thisArg?: any) => Array<U>;
filter: { (predicate: (value: Representation, index: number, array: Array<Representation>) => value is S, thisArg?: any): Array<S>; (predicate: (value: Representation, index: number, array: Array<Representation>) => unknown, thisArg?: any): Array<…;
reduce: { (callbackfn: (previousValue: Representation, currentValue: Representation, currentIndex: number, array: Array<Representation>) => Representation): Representation; (callbackfn: (previousValue: Representation, currentValue: Representation,…;
reduceRight: { (callbackfn: (previousValue: Representation, currentValue: Representation, currentIndex: number, array: Array<Representation>) => Representation): Representation; (callbackfn: (previousValue: Representation, currentValue: Representation,…;
find: { (predicate: (value: Representation, index: number, obj: Array<Representation>) => value is S, thisArg?: any): S | undefined; (predicate: (value: Representation, index: number, obj: Array<Representation>) => unknown, thisArg?: any): Repre…;
findIndex: (predicate: (value: Representation, index: number, obj: Array<Representation>) => unknown, thisArg?: any) => number;
fill: (value: Representation, start?: number, end?: number) => [Representation, ...Representation[]];
copyWithin: (target: number, start: number, end?: number) => [Representation, ...Representation[]];
entries: () => ArrayIterator<[number, Representation]>;
keys: () => ArrayIterator<number>;
values: () => ArrayIterator<Representation>;
includes: (searchElement: Representation, fromIndex?: number) => boolean;
flatMap: (callback: (this: This, value: Representation, index: number, array: Array<Representation>) => U | ReadonlyArray<U>, thisArg?: This | undefined) => Array<U>;
flat: (this: A, depth?: D | undefined) => Array<FlatArray<A, D>>;
at: (index: number) => Representation | undefined;
findLast: { (predicate: (value: Representation, index: number, array: Array<Representation>) => value is S, thisArg?: any): S | undefined; (predicate: (value: Representation, index: number, array: Array<Representation>) => unknown, thisArg?: any): R…;
findLastIndex: (predicate: (value: Representation, index: number, array: Array<Representation>) => unknown, thisArg?: any) => number;
toReversed: () => Array<Representation>;
toSorted: (compareFn?: ((a: Representation, b: Representation) => number) | undefined) => Array<Representation>;
toSpliced: { (start: number, deleteCount: number, ...items: Array<Representation>): Array<Representation>; (start: number, deleteCount?: number): Array<Representation> };
with: (index: number, value: Representation) => Array<Representation>;
}
representations = import ArrArr.map(document: JsonSchema.MultiDocument<"draft-2020-12">(parameter) document: {
dialect: D;
schemas: readonly [JsonSchema, ...Array<JsonSchema>];
definitions: Definitions;
}
document.schemas, (schema: JsonSchema.JsonSchemaschema) => function (local function) unknownToJson(representation: Representation): RepresentationunknownToJson(function (local function) recur(u: unknown): Representationrecur(schema: JsonSchema.JsonSchemaschema)))
return {
representations: readonly [
Representation,
...Representation[]
]
(property) representations: {
0: Representation;
length: number;
toString: () => string;
toLocaleString: { (): string; (locales: string | string[], options?: Intl.NumberFormatOptions & Intl.DateTimeFormatOptions): string };
pop: () => Representation | undefined;
push: (...items: Array<Representation>) => number;
concat: { (...items: Array<ConcatArray<Representation>>): Array<Representation>; (...items: Array<Representation | ConcatArray<Representation>>): Array<Representation> };
join: (separator?: string) => string;
reverse: () => Array<Representation>;
shift: () => Representation | undefined;
slice: (start?: number, end?: number) => Array<Representation>;
sort: (compareFn?: ((a: Representation, b: Representation) => number) | undefined) => [Representation, ...Representation[]];
splice: { (start: number, deleteCount?: number): Array<Representation>; (start: number, deleteCount: number, ...items: Array<Representation>): Array<Representation> };
unshift: (...items: Array<Representation>) => number;
indexOf: (searchElement: Representation, fromIndex?: number) => number;
lastIndexOf: (searchElement: Representation, fromIndex?: number) => number;
every: { (predicate: (value: Representation, index: number, array: Array<Representation>) => value is S, thisArg?: any): this is S[]; (predicate: (value: Representation, index: number, array: Array<Representation>) => unknown, thisArg?: any): boo…;
some: (predicate: (value: Representation, index: number, array: Array<Representation>) => unknown, thisArg?: any) => boolean;
forEach: (callbackfn: (value: Representation, index: number, array: Array<Representation>) => void, thisArg?: any) => void;
map: (callbackfn: (value: Representation, index: number, array: Array<Representation>) => U, thisArg?: any) => Array<U>;
filter: { (predicate: (value: Representation, index: number, array: Array<Representation>) => value is S, thisArg?: any): Array<S>; (predicate: (value: Representation, index: number, array: Array<Representation>) => unknown, thisArg?: any): Array<…;
reduce: { (callbackfn: (previousValue: Representation, currentValue: Representation, currentIndex: number, array: Array<Representation>) => Representation): Representation; (callbackfn: (previousValue: Representation, currentValue: Representation,…;
reduceRight: { (callbackfn: (previousValue: Representation, currentValue: Representation, currentIndex: number, array: Array<Representation>) => Representation): Representation; (callbackfn: (previousValue: Representation, currentValue: Representation,…;
find: { (predicate: (value: Representation, index: number, obj: Array<Representation>) => value is S, thisArg?: any): S | undefined; (predicate: (value: Representation, index: number, obj: Array<Representation>) => unknown, thisArg?: any): Repre…;
findIndex: (predicate: (value: Representation, index: number, obj: Array<Representation>) => unknown, thisArg?: any) => number;
fill: (value: Representation, start?: number, end?: number) => [Representation, ...Representation[]];
copyWithin: (target: number, start: number, end?: number) => [Representation, ...Representation[]];
entries: () => ArrayIterator<[number, Representation]>;
keys: () => ArrayIterator<number>;
values: () => ArrayIterator<Representation>;
includes: (searchElement: Representation, fromIndex?: number) => boolean;
flatMap: (callback: (this: This, value: Representation, index: number, array: Array<Representation>) => U | ReadonlyArray<U>, thisArg?: This | undefined) => Array<U>;
flat: (this: A, depth?: D | undefined) => Array<FlatArray<A, D>>;
at: (index: number) => Representation | undefined;
findLast: { (predicate: (value: Representation, index: number, array: Array<Representation>) => value is S, thisArg?: any): S | undefined; (predicate: (value: Representation, index: number, array: Array<Representation>) => unknown, thisArg?: any): R…;
findLastIndex: (predicate: (value: Representation, index: number, array: Array<Representation>) => unknown, thisArg?: any) => number;
toReversed: () => Array<Representation>;
toSorted: (compareFn?: ((a: Representation, b: Representation) => number) | undefined) => Array<Representation>;
toSpliced: { (start: number, deleteCount: number, ...items: Array<Representation>): Array<Representation>; (start: number, deleteCount?: number): Array<Representation> };
with: (index: number, value: Representation) => Array<Representation>;
}
representations,
references: Record<string, Representation>references
}
function function (local function) recur(u: unknown): Representationrecur(u: unknownu: unknown): type Representation =
| Declaration
| Reference
| Suspend
| Null
| Undefined
| Void
| Never
| Unknown
| Any
| String
| Number
| Boolean
| BigInt
| Symbol
| Literal
| UniqueSymbol
| ObjectKeyword
| Enum
| TemplateLiteral
| Arrays
| Objects
| Union
The core tagged union of all supported schema shapes.
Details
Each variant has a _tag discriminator. Switch on _tag to handle each
shape. Most variants carry optional annotations and some carry checks
for validation constraints.
Representation {
if (u: unknownu === false) return const never: Neverconst never: {
_tag: "Never";
annotations: Schema.Annotations.Annotations | undefined;
}
never
if (!import PredicatePredicate.isObject(u: unknownu)) return const unknown: Unknownconst unknown: {
_tag: "Unknown";
annotations: Schema.Annotations.Annotations | undefined;
}
unknown
let let js: JsonSchema.JsonSchemajs: import JsonSchemaJsonSchema.type JsonSchema.JsonSchema = /*unresolved*/ anyJsonSchema = options: {
readonly onEnter?:
| ((
js: JsonSchema.JsonSchema
) => JsonSchema.JsonSchema)
| undefined
}
options?.onEnter?: | ((
js: JsonSchema.JsonSchema
) => JsonSchema.JsonSchema)
| undefined
onEnter?.(u: unknownu) ?? u: unknownu
if (var Array: ArrayConstructorArray.ArrayConstructor.isArray(arg: any): arg is any[]isArray(let js: JsonSchema.JsonSchemajs.type)) {
if (let js: JsonSchema.JsonSchemajs.type.every(function isType(
type: unknown
): type is JsonSchema.Type
isType)) {
const { const type: Array<JsonSchema.Type>type, ...const rest: JsonSchema.JsonSchemarest } = let js: JsonSchema.JsonSchemajs
let js: JsonSchema.JsonSchemajs = {
anyOf: anyanyOf: const type: Array<JsonSchema.Type>type.map((type: JsonSchema.Typetype) => ({ type: JsonSchema.Typetype })),
...const rest: JsonSchema.JsonSchemarest
}
} else {
let js: JsonSchema.JsonSchemajs = {}
}
}
let let out: Representationout = function (local function) on(js: JsonSchema.JsonSchema): Representationon(let js: JsonSchema.JsonSchemajs)
const const annotations: anyannotations = function collectAnnotations(
schema: JsonSchema.JsonSchema
): Schema.Annotations.Annotations | undefined
collectAnnotations(let js: JsonSchema.JsonSchemajs)
if (const annotations: anyannotations !== var undefinedundefined) {
let out: Representationout = function (local function) combine(a: Representation, b: Representation): Representationcombine(let out: Representationout, { Unknown._tag: "Unknown"_tag: "Unknown", Unknown.annotations?: anyannotations })
}
if (var Array: ArrayConstructorArray.ArrayConstructor.isArray(arg: any): arg is any[]isArray(let js: JsonSchema.JsonSchemajs.allOf)) {
let out: Representationout = let js: JsonSchema.JsonSchemajs.allOf.reduce((acc: anyacc, curr: anycurr) => function (local function) combine(a: Representation, b: Representation): Representationcombine(acc: anyacc, function (local function) recur(u: unknown): Representationrecur(curr: anycurr)), let out: Representationout)
}
if (var Array: ArrayConstructorArray.ArrayConstructor.isArray(arg: any): arg is any[]isArray(let js: JsonSchema.JsonSchemajs.anyOf)) {
let out: Representationout = function (local function) combine(a: Representation, b: Representation): Representationcombine({ Union._tag: "Union"_tag: "Union", Union.types: Array<Representation>types: let js: JsonSchema.JsonSchemajs.anyOf.map((type: anytype) => function (local function) recur(u: unknown): Representationrecur(type: anytype)), Union.mode: "anyOf" | "oneOf"mode: "anyOf" }, let out: Representationout)
}
if (var Array: ArrayConstructorArray.ArrayConstructor.isArray(arg: any): arg is any[]isArray(let js: JsonSchema.JsonSchemajs.oneOf)) {
let out: Representationout = function (local function) combine(a: Representation, b: Representation): Representationcombine({ Union._tag: "Union"_tag: "Union", Union.types: Array<Representation>types: let js: JsonSchema.JsonSchemajs.oneOf.map((type: anytype) => function (local function) recur(u: unknown): Representationrecur(type: anytype)), Union.mode: "anyOf" | "oneOf"mode: "oneOf" }, let out: Representationout)
}
return let out: Representationout
}
function function (local function) on(js: JsonSchema.JsonSchema): Representationon(js: JsonSchema.JsonSchemajs: import JsonSchemaJsonSchema.type JsonSchema.JsonSchema = /*unresolved*/ anyJsonSchema): type Representation =
| Declaration
| Reference
| Suspend
| Null
| Undefined
| Void
| Never
| Unknown
| Any
| String
| Number
| Boolean
| BigInt
| Symbol
| Literal
| UniqueSymbol
| ObjectKeyword
| Enum
| TemplateLiteral
| Arrays
| Objects
| Union
The core tagged union of all supported schema shapes.
Details
Each variant has a _tag discriminator. Switch on _tag to handle each
shape. Most variants carry optional annotations and some carry checks
for validation constraints.
Representation {
if (typeof js: JsonSchema.JsonSchemajs.$ref === "string") {
const const $ref: any$ref = js: JsonSchema.JsonSchemajs.$ref.slice(2).split("/").at(-1)
if (const $ref: any$ref !== var undefinedundefined) {
const const reference: Referenceconst reference: {
_tag: "Reference";
$ref: string;
}
reference: Reference = { Reference._tag: "Reference"_tag: "Reference", Reference.$ref: string$ref: import unescapeTokenunescapeToken(const $ref: any$ref) }
if (let definitionIdentifier:
| string
| undefined
definitionIdentifier === const $ref: any$ref) {
return { Suspend._tag: "Suspend"_tag: "Suspend", Suspend.thunk: Reference(property) Suspend.thunk: {
_tag: "Reference";
$ref: string;
}
thunk: const reference: Referenceconst reference: {
_tag: "Reference";
$ref: string;
}
reference, Suspend.checks: readonly [](property) Suspend.checks: {
length: 0;
toString: () => string;
toLocaleString: { (): string; (locales: string | string[], options?: Intl.NumberFormatOptions & Intl.DateTimeFormatOptions): string };
pop: () => undefined;
push: (...items: Array<never>) => number;
concat: { (...items: Array<ConcatArray<never>>): Array<never>; (...items: Array<ConcatArray<never>>): Array<never> };
join: (separator?: string) => string;
reverse: () => Array<never>;
shift: () => undefined;
slice: (start?: number, end?: number) => Array<never>;
sort: (compareFn?: ((a: never, b: never) => number) | undefined) => [];
splice: { (start: number, deleteCount?: number): Array<never>; (start: number, deleteCount: number, ...items: Array<never>): Array<never> };
unshift: (...items: Array<never>) => number;
indexOf: (searchElement: never, fromIndex?: number) => number;
lastIndexOf: (searchElement: never, fromIndex?: number) => number;
every: { (predicate: (value: never, index: number, array: Array<never>) => value is S, thisArg?: any): this is S[]; (predicate: (value: never, index: number, array: Array<never>) => unknown, thisArg?: any): boolean };
some: (predicate: (value: never, index: number, array: Array<never>) => unknown, thisArg?: any) => boolean;
forEach: (callbackfn: (value: never, index: number, array: Array<never>) => void, thisArg?: any) => void;
map: (callbackfn: (value: never, index: number, array: Array<never>) => U, thisArg?: any) => Array<U>;
filter: { (predicate: (value: never, index: number, array: Array<never>) => value is S, thisArg?: any): Array<S>; (predicate: (value: never, index: number, array: Array<never>) => unknown, thisArg?: any): Array<never> };
reduce: { (callbackfn: (previousValue: never, currentValue: never, currentIndex: number, array: Array<never>) => never): never; (callbackfn: (previousValue: never, currentValue: never, currentIndex: number, array: Array<never>) => never, initialVa…;
reduceRight: { (callbackfn: (previousValue: never, currentValue: never, currentIndex: number, array: Array<never>) => never): never; (callbackfn: (previousValue: never, currentValue: never, currentIndex: number, array: Array<never>) => never, initialVa…;
find: { (predicate: (value: never, index: number, obj: Array<never>) => value is S, thisArg?: any): S | undefined; (predicate: (value: never, index: number, obj: Array<never>) => unknown, thisArg?: any): undefined };
findIndex: (predicate: (value: never, index: number, obj: Array<never>) => unknown, thisArg?: any) => number;
fill: (value: never, start?: number, end?: number) => [];
copyWithin: (target: number, start: number, end?: number) => [];
entries: () => ArrayIterator<[number, never]>;
keys: () => ArrayIterator<number>;
values: () => ArrayIterator<never>;
includes: (searchElement: never, fromIndex?: number) => boolean;
flatMap: (callback: (this: This, value: never, index: number, array: Array<never>) => U | ReadonlyArray<U>, thisArg?: This | undefined) => Array<U>;
flat: (this: A, depth?: D | undefined) => Array<FlatArray<A, D>>;
at: (index: number) => undefined;
findLast: { (predicate: (value: never, index: number, array: Array<never>) => value is S, thisArg?: any): S | undefined; (predicate: (value: never, index: number, array: Array<never>) => unknown, thisArg?: any): undefined };
findLastIndex: (predicate: (value: never, index: number, array: Array<never>) => unknown, thisArg?: any) => number;
toReversed: () => Array<never>;
toSorted: (compareFn?: ((a: never, b: never) => number) | undefined) => Array<never>;
toSpliced: { (start: number, deleteCount: number, ...items: Array<never>): Array<never>; (start: number, deleteCount?: number): Array<never> };
with: (index: number, value: never) => Array<never>;
}
checks: [] }
} else {
return const reference: Referenceconst reference: {
_tag: "Reference";
$ref: string;
}
reference
}
}
} else if ("const" in js: JsonSchema.JsonSchemajs) {
if (function isLiteralValue(
value: unknown
): value is SchemaAST.LiteralValue
isLiteralValue(js: JsonSchema.JsonSchemajs.const)) {
return { Literal._tag: "Literal"_tag: "Literal", Literal.literal: SchemaAST.LiteralValueliteral: js: JsonSchema.JsonSchemajs.const }
} else if (js: JsonSchema.JsonSchemajs.const === null) {
return const null_: Nullconst null_: {
_tag: "Null";
annotations: Schema.Annotations.Annotations | undefined;
}
null_
}
} else if (var Array: ArrayConstructorArray.ArrayConstructor.isArray(arg: any): arg is any[]isArray(js: JsonSchema.JsonSchemajs.enum)) {
const const types: Array<Representation>types: interface Array<T>Array<type Representation =
| Declaration
| Reference
| Suspend
| Null
| Undefined
| Void
| Never
| Unknown
| Any
| String
| Number
| Boolean
| BigInt
| Symbol
| Literal
| UniqueSymbol
| ObjectKeyword
| Enum
| TemplateLiteral
| Arrays
| Objects
| Union
The core tagged union of all supported schema shapes.
Details
Each variant has a _tag discriminator. Switch on _tag to handle each
shape. Most variants carry optional annotations and some carry checks
for validation constraints.
Representation> = []
for (const const e: anye of js: JsonSchema.JsonSchemajs.enum) {
if (function isLiteralValue(
value: unknown
): value is SchemaAST.LiteralValue
isLiteralValue(const e: anye)) {
const types: Array<Representation>types.Array<Representation>.push(...items: Representation[]): numberAppends new elements to the end of an array, and returns the new length of the array.
push({ Literal._tag: "Literal"_tag: "Literal", Literal.literal: SchemaAST.LiteralValueliteral: const e: SchemaAST.LiteralValuee })
} else if (const e: anye === null) {
const types: Array<Representation>types.Array<Representation>.push(...items: Representation[]): numberAppends new elements to the end of an array, and returns the new length of the array.
push(const null_: Nullconst null_: {
_tag: "Null";
annotations: Schema.Annotations.Annotations | undefined;
}
null_)
} else {
const types: Array<Representation>types.Array<Representation>.push(...items: Representation[]): numberAppends new elements to the end of an array, and returns the new length of the array.
push(function (local function) recur(u: unknown): Representationrecur(const e: anye))
}
}
if (const types: Array<Representation>types.Array<Representation>.length: numberGets or sets the length of the array. This is a number one higher than the highest index in the array.
length === 1) {
return const types: Array<Representation>types[0]
} else {
return { Union._tag: "Union"_tag: "Union", Union.types: Array<Representation>types, Union.mode: "anyOf" | "oneOf"mode: "anyOf" }
}
}
const const type: anytype = function isType(
type: unknown
): type is JsonSchema.Type
isType(js: JsonSchema.JsonSchemajs.type) ? js: JsonSchema.JsonSchemajs.type : function getType(
js: JsonSchema.JsonSchema
): JsonSchema.Type | undefined
getType(js: JsonSchema.JsonSchemajs)
if (const type: anytype !== var undefinedundefined) {
switch (const type: JsonSchema.Typetype) {
case "null":
return const null_: Nullconst null_: {
_tag: "Null";
annotations: Schema.Annotations.Annotations | undefined;
}
null_
case "string": {
const const checks: Array<Check<StringMeta>>checks = function collectStringChecks(
js: JsonSchema.JsonSchema
): Array<Check<StringMeta>>
collectStringChecks(js: JsonSchema.JsonSchemajs)
if (const checks: Array<Check<StringMeta>>checks.Array<T>.length: numberGets or sets the length of the array. This is a number one higher than the highest index in the array.
length > 0) {
return { ...const string: Stringconst string: {
_tag: "String";
annotations: Schema.Annotations.Annotations | undefined;
checks: ReadonlyArray<Check<StringMeta>>;
contentMediaType: string | undefined;
contentSchema: Representation | undefined;
}
string, checks: Array<Check<StringMeta>>checks }
}
return const string: Stringconst string: {
_tag: "String";
annotations: Schema.Annotations.Annotations | undefined;
checks: ReadonlyArray<Check<StringMeta>>;
contentMediaType: string | undefined;
contentSchema: Representation | undefined;
}
string
}
case "number":
return {
Number._tag: "Number"_tag: "Number",
Number.checks: Array<Check<NumberMeta>>checks: [{ Filter<M>._tag: "Filter"_tag: "Filter", Filter<any>.meta: any(property) Filter<any>.meta: {
_tag: 'isFinite';
}
meta: { _tag: string_tag: "isFinite" } }, ...function collectNumberChecks(
js: JsonSchema.JsonSchema
): Array<Check<NumberMeta>>
collectNumberChecks(js: JsonSchema.JsonSchemajs)]
}
case "integer":
return {
Number._tag: "Number"_tag: "Number",
Number.checks: Array<Check<NumberMeta>>checks: [{ Filter<M>._tag: "Filter"_tag: "Filter", Filter<any>.meta: any(property) Filter<any>.meta: {
_tag: 'isInt';
}
meta: { _tag: string_tag: "isInt" } }, ...function collectNumberChecks(
js: JsonSchema.JsonSchema
): Array<Check<NumberMeta>>
collectNumberChecks(js: JsonSchema.JsonSchemajs)]
}
case "boolean":
return const boolean: Booleanconst boolean: {
_tag: "Boolean";
annotations: Schema.Annotations.Annotations | undefined;
}
boolean
case "array": {
const const minItems: anyminItems = typeof js: JsonSchema.JsonSchemajs.minItems === "number" ? js: JsonSchema.JsonSchemajs.minItems : 0
const const elements: Array<Element>elements: interface Array<T>Array<Element> = (var Array: ArrayConstructorArray.ArrayConstructor.isArray(arg: any): arg is any[]isArray(js: JsonSchema.JsonSchemajs.prefixItems) ? js: JsonSchema.JsonSchemajs.prefixItems : []).map((e: anye, i: anyi) => ({
isOptional: booleanisOptional: i: anyi + 1 > const minItems: anyminItems,
type: Representationtype: function (local function) recur(u: unknown): Representationrecur(e: anye)
}))
const const rest: Array<Representation>rest: interface Array<T>Array<type Representation =
| Declaration
| Reference
| Suspend
| Null
| Undefined
| Void
| Never
| Unknown
| Any
| String
| Number
| Boolean
| BigInt
| Symbol
| Literal
| UniqueSymbol
| ObjectKeyword
| Enum
| TemplateLiteral
| Arrays
| Objects
| Union
The core tagged union of all supported schema shapes.
Details
Each variant has a _tag discriminator. Switch on _tag to handle each
shape. Most variants carry optional annotations and some carry checks
for validation constraints.
Representation> = js: JsonSchema.JsonSchemajs.items !== var undefinedundefined ?
[function (local function) recur(u: unknown): Representationrecur(js: JsonSchema.JsonSchemajs.items)]
: js: JsonSchema.JsonSchemajs.prefixItems !== var undefinedundefined && typeof js: JsonSchema.JsonSchemajs.maxItems === "number"
? []
: [const unknown: Unknownconst unknown: {
_tag: "Unknown";
annotations: Schema.Annotations.Annotations | undefined;
}
unknown]
return { Arrays._tag: "Arrays"_tag: "Arrays", Arrays.elements: Array<Element>elements, Arrays.rest: Array<Representation>rest, Arrays.checks: Array<Check<ArraysMeta>>checks: function collectArraysChecks(
js: JsonSchema.JsonSchema
): Array<Check<ArraysMeta>>
collectArraysChecks(js: JsonSchema.JsonSchemajs) }
}
case "object": {
return {
Objects._tag: "Objects"_tag: "Objects",
Objects.propertySignatures: Array<PropertySignature>propertySignatures: function (local function) collectProperties(js: JsonSchema.JsonSchema): Array<PropertySignature>collectProperties(js: JsonSchema.JsonSchemajs),
Objects.indexSignatures: Array<IndexSignature>indexSignatures: function (local function) collectIndexSignatures(js: JsonSchema.JsonSchema): Array<IndexSignature>collectIndexSignatures(js: JsonSchema.JsonSchemajs),
Objects.checks: Array<Check<ObjectsMeta>>checks: function (local function) collectObjectsChecks(js: JsonSchema.JsonSchema): Array<Check<ObjectsMeta>>collectObjectsChecks(js: JsonSchema.JsonSchemajs)
}
}
}
}
return { Unknown._tag: "Unknown"_tag: "Unknown" }
}
function function (local function) collectObjectsChecks(js: JsonSchema.JsonSchema): Array<Check<ObjectsMeta>>collectObjectsChecks(js: JsonSchema.JsonSchemajs: import JsonSchemaJsonSchema.type JsonSchema.JsonSchema = /*unresolved*/ anyJsonSchema): interface Array<T>Array<type Check<M> = Filter<M> | FilterGroup<M>A validation constraint attached to a type. Either a single
Filter
or a
FilterGroup
combining multiple checks.
Check<type ObjectsMeta = anyMetadata union for object-specific validation checks (minProperties,
maxProperties, propertiesLength, propertyNames).
ObjectsMeta>> {
const const checks: Array<Check<ObjectsMeta>>checks: interface Array<T>Array<type Check<M> = Filter<M> | FilterGroup<M>A validation constraint attached to a type. Either a single
Filter
or a
FilterGroup
combining multiple checks.
Check<type ObjectsMeta = anyMetadata union for object-specific validation checks (minProperties,
maxProperties, propertiesLength, propertyNames).
ObjectsMeta>> = []
if (typeof js: JsonSchema.JsonSchemajs.minProperties === "number") {
const checks: Array<Check<ObjectsMeta>>checks.Array<Check<any>>.push(...items: Check<any>[]): numberAppends new elements to the end of an array, and returns the new length of the array.
push({ Filter<M>._tag: "Filter"_tag: "Filter", Filter<any>.meta: any(property) Filter<any>.meta: {
_tag: 'isMinProperties';
minProperties: number;
}
meta: { _tag: string_tag: "isMinProperties", minProperties: anyminProperties: js: JsonSchema.JsonSchemajs.minProperties } })
}
if (typeof js: JsonSchema.JsonSchemajs.maxProperties === "number") {
const checks: Array<Check<ObjectsMeta>>checks.Array<Check<any>>.push(...items: Check<any>[]): numberAppends new elements to the end of an array, and returns the new length of the array.
push({ Filter<M>._tag: "Filter"_tag: "Filter", Filter<any>.meta: any(property) Filter<any>.meta: {
_tag: 'isMaxProperties';
maxProperties: number;
}
meta: { _tag: string_tag: "isMaxProperties", maxProperties: anymaxProperties: js: JsonSchema.JsonSchemajs.maxProperties } })
}
if (js: JsonSchema.JsonSchemajs.propertyNames !== var undefinedundefined) {
const const propertyNames: RepresentationpropertyNames = function (local function) recur(u: unknown): Representationrecur(js: JsonSchema.JsonSchemajs.propertyNames)
const checks: Array<Check<ObjectsMeta>>checks.Array<Check<any>>.push(...items: Check<any>[]): numberAppends new elements to the end of an array, and returns the new length of the array.
push({ Filter<M>._tag: "Filter"_tag: "Filter", Filter<any>.meta: any(property) Filter<any>.meta: {
_tag: 'isPropertyNames';
propertyNames: Representation;
}
meta: { _tag: string_tag: "isPropertyNames", propertyNames: RepresentationpropertyNames } })
}
return const checks: Array<Check<ObjectsMeta>>checks
}
function function (local function) combine(a: Representation, b: Representation): Representationcombine(a: Representationa: type Representation =
| Declaration
| Reference
| Suspend
| Null
| Undefined
| Void
| Never
| Unknown
| Any
| String
| Number
| Boolean
| BigInt
| Symbol
| Literal
| UniqueSymbol
| ObjectKeyword
| Enum
| TemplateLiteral
| Arrays
| Objects
| Union
The core tagged union of all supported schema shapes.
Details
Each variant has a _tag discriminator. Switch on _tag to handle each
shape. Most variants carry optional annotations and some carry checks
for validation constraints.
Representation, b: Representationb: type Representation =
| Declaration
| Reference
| Suspend
| Null
| Undefined
| Void
| Never
| Unknown
| Any
| String
| Number
| Boolean
| BigInt
| Symbol
| Literal
| UniqueSymbol
| ObjectKeyword
| Enum
| TemplateLiteral
| Arrays
| Objects
| Union
The core tagged union of all supported schema shapes.
Details
Each variant has a _tag discriminator. Switch on _tag to handle each
shape. Most variants carry optional annotations and some carry checks
for validation constraints.
Representation): type Representation =
| Declaration
| Reference
| Suspend
| Null
| Undefined
| Void
| Never
| Unknown
| Any
| String
| Number
| Boolean
| BigInt
| Symbol
| Literal
| UniqueSymbol
| ObjectKeyword
| Enum
| TemplateLiteral
| Arrays
| Objects
| Union
The core tagged union of all supported schema shapes.
Details
Each variant has a _tag discriminator. Switch on _tag to handle each
shape. Most variants carry optional annotations and some carry checks
for validation constraints.
Representation {
switch (a: Representationa._tag: | "Declaration"
| "Suspend"
| "Reference"
| "Null"
| "Undefined"
| "Void"
| "Never"
| "Unknown"
| "Any"
| "String"
| "Number"
| "Boolean"
| "BigInt"
| "Symbol"
| "Literal"
| "UniqueSymbol"
| "ObjectKeyword"
| "Enum"
| "TemplateLiteral"
| "Arrays"
| "Objects"
| "Union"
_tag) {
default:
return const never: Neverconst never: {
_tag: "Never";
annotations: Schema.Annotations.Annotations | undefined;
}
never
case "Reference":
return function (local function) combine(a: Representation, b: Representation): Representationcombine(function (local function) resolveReference($ref: string): Declaration | Suspend | Null | Undefined | Void | Never | Unknown | Any | String | Number | Boolean | BigInt | Symbol | Literal | UniqueSymbol | ObjectKeyword | Enum | TemplateLiteral | Arrays | Objects | UnionresolveReference(a: Representation(parameter) a: {
_tag: "Reference";
$ref: string;
}
a.Reference.$ref: string$ref), b: Representationb)
case "Never":
return a: Representation(parameter) a: {
_tag: "Never";
annotations: Schema.Annotations.Annotations | undefined;
}
a
case "Unknown": {
const const resolved:
| Declaration
| Suspend
| Null
| Undefined
| Void
| Never
| Unknown
| Any
| String
| Number
| Boolean
| BigInt
| Symbol
| Literal
| UniqueSymbol
| ObjectKeyword
| Enum
| TemplateLiteral
| Arrays
| Objects
| Union
resolved = b: Representationb._tag: | "Declaration"
| "Suspend"
| "Reference"
| "Null"
| "Undefined"
| "Void"
| "Never"
| "Unknown"
| "Any"
| "String"
| "Number"
| "Boolean"
| "BigInt"
| "Symbol"
| "Literal"
| "UniqueSymbol"
| "ObjectKeyword"
| "Enum"
| "TemplateLiteral"
| "Arrays"
| "Objects"
| "Union"
_tag === "Reference" ? function (local function) resolveReference($ref: string): Declaration | Suspend | Null | Undefined | Void | Never | Unknown | Any | String | Number | Boolean | BigInt | Symbol | Literal | UniqueSymbol | ObjectKeyword | Enum | TemplateLiteral | Arrays | Objects | UnionresolveReference(b: Representation(parameter) b: {
_tag: "Reference";
$ref: string;
}
b.Reference.$ref: string$ref) : b: Representationb
return { ...const resolved:
| Declaration
| Suspend
| Null
| Undefined
| Void
| Never
| Unknown
| Any
| String
| Number
| Boolean
| BigInt
| Symbol
| Literal
| UniqueSymbol
| ObjectKeyword
| Enum
| TemplateLiteral
| Arrays
| Objects
| Union
resolved, ...function combineAnnotations(
a: Schema.Annotations.Annotations | undefined,
b: Schema.Annotations.Annotations | undefined
):
| {
annotations: Schema.Annotations.Annotations
}
| undefined
combineAnnotations(a: Representation(parameter) a: {
_tag: "Unknown";
annotations: Schema.Annotations.Annotations | undefined;
}
a.Unknown.annotations?: anyannotations, const resolved:
| Declaration
| Suspend
| Null
| Undefined
| Void
| Never
| Unknown
| Any
| String
| Number
| Boolean
| BigInt
| Symbol
| Literal
| UniqueSymbol
| ObjectKeyword
| Enum
| TemplateLiteral
| Arrays
| Objects
| Union
resolved.annotations?: anyannotations) }
}
case "Null":
case "String":
case "Number":
case "Boolean":
case "Literal":
case "Arrays":
case "Objects":
case "Union":
break
}
if (b: Representationb._tag: | "Declaration"
| "Suspend"
| "Reference"
| "Null"
| "Undefined"
| "Void"
| "Never"
| "Unknown"
| "Any"
| "String"
| "Number"
| "Boolean"
| "BigInt"
| "Symbol"
| "Literal"
| "UniqueSymbol"
| "ObjectKeyword"
| "Enum"
| "TemplateLiteral"
| "Arrays"
| "Objects"
| "Union"
_tag === "Reference") {
return function (local function) combine(a: Representation, b: Representation): Representationcombine(a: Representationa, function (local function) resolveReference($ref: string): Declaration | Suspend | Null | Undefined | Void | Never | Unknown | Any | String | Number | Boolean | BigInt | Symbol | Literal | UniqueSymbol | ObjectKeyword | Enum | TemplateLiteral | Arrays | Objects | UnionresolveReference(b: Representation(parameter) b: {
_tag: "Reference";
$ref: string;
}
b.Reference.$ref: string$ref))
}
if (b: Representationb._tag: | "Declaration"
| "Suspend"
| "Null"
| "Undefined"
| "Void"
| "Never"
| "Unknown"
| "Any"
| "String"
| "Number"
| "Boolean"
| "BigInt"
| "Symbol"
| "Literal"
| "UniqueSymbol"
| "ObjectKeyword"
| "Enum"
| "TemplateLiteral"
| "Arrays"
| "Objects"
| "Union"
_tag === "Unknown") {
return { ...a: Representationa, ...function combineAnnotations(
a: Schema.Annotations.Annotations | undefined,
b: Schema.Annotations.Annotations | undefined
):
| {
annotations: Schema.Annotations.Annotations
}
| undefined
combineAnnotations(a: Representationa.annotations?: anyannotations, b: Representation(parameter) b: {
_tag: "Unknown";
annotations: Schema.Annotations.Annotations | undefined;
}
b.Unknown.annotations?: anyannotations) }
}
if (a: Representationa._tag: | "Null"
| "String"
| "Number"
| "Boolean"
| "Literal"
| "Arrays"
| "Objects"
| "Union"
_tag === "Union") {
const const types: Array<Representation>types = a: Representation(parameter) a: {
_tag: "Union";
annotations: Schema.Annotations.Annotations | undefined;
types: ReadonlyArray<Representation>;
mode: "anyOf" | "oneOf";
}
a.Union.types: ReadonlyArray<Representation>types.ReadonlyArray<Representation>.map<Representation>(callbackfn: (value: Representation, index: number, array: readonly Representation[]) => Representation, thisArg?: any): Representation[]Calls a defined callback function on each element of an array, and returns an array that contains the results.
map((s: Representations) => function (local function) combine(a: Representation, b: Representation): Representationcombine(s: Representations, b: Representationb)).Array<Representation>.filter(predicate: (value: Representation, index: number, array: Representation[]) => unknown, thisArg?: any): Representation[] (+1 overload)Returns the elements of an array that meet the condition specified in a callback function.
filter((s: Representations) => s: Representations !== const never: Neverconst never: {
_tag: "Never";
annotations: Schema.Annotations.Annotations | undefined;
}
never)
if (const types: Array<Representation>types.Array<Representation>.length: numberGets or sets the length of the array. This is a number one higher than the highest index in the array.
length === 0) return const never: Neverconst never: {
_tag: "Never";
annotations: Schema.Annotations.Annotations | undefined;
}
never
return {
Union._tag: "Union"_tag: "Union",
Union.types: Array<Representation>types,
Union.mode: "anyOf" | "oneOf"mode: a: Representation(parameter) a: {
_tag: "Union";
annotations: Schema.Annotations.Annotations | undefined;
types: ReadonlyArray<Representation>;
mode: "anyOf" | "oneOf";
}
a.Union.mode: "anyOf" | "oneOf"mode,
...function makeAnnotations(
annotations:
| Schema.Annotations.Annotations
| undefined
):
| {
annotations: Schema.Annotations.Annotations
}
| undefined
makeAnnotations(a: Representation(parameter) a: {
_tag: "Union";
annotations: Schema.Annotations.Annotations | undefined;
types: ReadonlyArray<Representation>;
mode: "anyOf" | "oneOf";
}
a.Union.annotations?: anyannotations)
}
}
if (b: Representationb._tag: | "Declaration"
| "Suspend"
| "Null"
| "Undefined"
| "Void"
| "Never"
| "Any"
| "String"
| "Number"
| "Boolean"
| "BigInt"
| "Symbol"
| "Literal"
| "UniqueSymbol"
| "ObjectKeyword"
| "Enum"
| "TemplateLiteral"
| "Arrays"
| "Objects"
| "Union"
_tag === "Union") {
return function (local function) combine(a: Representation, b: Representation): Representationcombine(b: Representation(parameter) b: {
_tag: "Union";
annotations: Schema.Annotations.Annotations | undefined;
types: ReadonlyArray<Representation>;
mode: "anyOf" | "oneOf";
}
b, a: Representationa)
}
switch (a: Representationa._tag: | "Null"
| "String"
| "Number"
| "Boolean"
| "Literal"
| "Arrays"
| "Objects"
_tag) {
case "Null":
return b: Representationb._tag: | "Declaration"
| "Suspend"
| "Null"
| "Undefined"
| "Void"
| "Never"
| "Any"
| "String"
| "Number"
| "Boolean"
| "BigInt"
| "Symbol"
| "Literal"
| "UniqueSymbol"
| "ObjectKeyword"
| "Enum"
| "TemplateLiteral"
| "Arrays"
| "Objects"
_tag === "Null" ? { ...a: Representation(parameter) a: {
_tag: "Null";
annotations: Schema.Annotations.Annotations | undefined;
}
a, ...function combineAnnotations(
a: Schema.Annotations.Annotations | undefined,
b: Schema.Annotations.Annotations | undefined
):
| {
annotations: Schema.Annotations.Annotations
}
| undefined
combineAnnotations(a: Representation(parameter) a: {
_tag: "Null";
annotations: Schema.Annotations.Annotations | undefined;
}
a.Null.annotations?: anyannotations, b: Representation(parameter) b: {
_tag: "Null";
annotations: Schema.Annotations.Annotations | undefined;
}
b.Null.annotations?: anyannotations) } : const never: Neverconst never: {
_tag: "Never";
annotations: Schema.Annotations.Annotations | undefined;
}
never
case "String": {
if (b: Representationb._tag: | "Declaration"
| "Suspend"
| "Null"
| "Undefined"
| "Void"
| "Never"
| "Any"
| "String"
| "Number"
| "Boolean"
| "BigInt"
| "Symbol"
| "Literal"
| "UniqueSymbol"
| "ObjectKeyword"
| "Enum"
| "TemplateLiteral"
| "Arrays"
| "Objects"
_tag === "Literal") {
return function (local function) satisfiesLiteral(type: String | Number, literal: Literal): booleansatisfiesLiteral(a: Representation(parameter) a: {
_tag: "String";
annotations: Schema.Annotations.Annotations | undefined;
checks: ReadonlyArray<Check<StringMeta>>;
contentMediaType: string | undefined;
contentSchema: Representation | undefined;
}
a, b: Representation(parameter) b: {
_tag: "Literal";
annotations: Schema.Annotations.Annotations | undefined;
literal: string | number | boolean | bigint;
}
b) ? { ...b: Representation(parameter) b: {
_tag: "Literal";
annotations: Schema.Annotations.Annotations | undefined;
literal: string | number | boolean | bigint;
}
b, ...function combineAnnotations(
a: Schema.Annotations.Annotations | undefined,
b: Schema.Annotations.Annotations | undefined
):
| {
annotations: Schema.Annotations.Annotations
}
| undefined
combineAnnotations(a: Representation(parameter) a: {
_tag: "String";
annotations: Schema.Annotations.Annotations | undefined;
checks: ReadonlyArray<Check<StringMeta>>;
contentMediaType: string | undefined;
contentSchema: Representation | undefined;
}
a.String.annotations?: anyannotations, b: Representation(parameter) b: {
_tag: "Literal";
annotations: Schema.Annotations.Annotations | undefined;
literal: string | number | boolean | bigint;
}
b.Literal.annotations?: anyannotations) } : const never: Neverconst never: {
_tag: "Never";
annotations: Schema.Annotations.Annotations | undefined;
}
never
}
if (b: Representationb._tag: | "Declaration"
| "Suspend"
| "Null"
| "Undefined"
| "Void"
| "Never"
| "Any"
| "String"
| "Number"
| "Boolean"
| "BigInt"
| "Symbol"
| "UniqueSymbol"
| "ObjectKeyword"
| "Enum"
| "TemplateLiteral"
| "Arrays"
| "Objects"
_tag !== "String") return const never: Neverconst never: {
_tag: "Never";
annotations: Schema.Annotations.Annotations | undefined;
}
never
const const checks: Check<any>[] | undefinedchecks = function combineChecks<M>(
a: ReadonlyArray<Check<M>>,
b: ReadonlyArray<Check<M>>,
annotations:
| Schema.Annotations.Annotations
| undefined
): Array<Check<M>> | undefined
combineChecks(a: Representation(parameter) a: {
_tag: "String";
annotations: Schema.Annotations.Annotations | undefined;
checks: ReadonlyArray<Check<StringMeta>>;
contentMediaType: string | undefined;
contentSchema: Representation | undefined;
}
a.String.checks: ReadonlyArray<Check<StringMeta>>checks, b: Representation(parameter) b: {
_tag: "String";
annotations: Schema.Annotations.Annotations | undefined;
checks: ReadonlyArray<Check<StringMeta>>;
contentMediaType: string | undefined;
contentSchema: Representation | undefined;
}
b.String.checks: ReadonlyArray<Check<StringMeta>>checks, b: Representation(parameter) b: {
_tag: "String";
annotations: Schema.Annotations.Annotations | undefined;
checks: ReadonlyArray<Check<StringMeta>>;
contentMediaType: string | undefined;
contentSchema: Representation | undefined;
}
b.String.annotations?: anyannotations)
return {
String._tag: "String"_tag: "String",
String.checks: ReadonlyArray<Check<StringMeta>>checks: const checks: Check<any>[] | undefinedchecks ?? a: Representation(parameter) a: {
_tag: "String";
annotations: Schema.Annotations.Annotations | undefined;
checks: ReadonlyArray<Check<StringMeta>>;
contentMediaType: string | undefined;
contentSchema: Representation | undefined;
}
a.String.checks: ReadonlyArray<Check<StringMeta>>checks,
...function combineAnnotations(
a: Schema.Annotations.Annotations | undefined,
b: Schema.Annotations.Annotations | undefined
):
| {
annotations: Schema.Annotations.Annotations
}
| undefined
combineAnnotations(a: Representation(parameter) a: {
_tag: "String";
annotations: Schema.Annotations.Annotations | undefined;
checks: ReadonlyArray<Check<StringMeta>>;
contentMediaType: string | undefined;
contentSchema: Representation | undefined;
}
a.String.annotations?: anyannotations, const checks: Check<any>[] | undefinedchecks ? var undefinedundefined : b: Representation(parameter) b: {
_tag: "String";
annotations: Schema.Annotations.Annotations | undefined;
checks: ReadonlyArray<Check<StringMeta>>;
contentMediaType: string | undefined;
contentSchema: Representation | undefined;
}
b.String.annotations?: anyannotations)
}
}
case "Number": {
if (b: Representationb._tag: | "Declaration"
| "Suspend"
| "Null"
| "Undefined"
| "Void"
| "Never"
| "Any"
| "String"
| "Number"
| "Boolean"
| "BigInt"
| "Symbol"
| "Literal"
| "UniqueSymbol"
| "ObjectKeyword"
| "Enum"
| "TemplateLiteral"
| "Arrays"
| "Objects"
_tag === "Literal") {
return function (local function) satisfiesLiteral(type: String | Number, literal: Literal): booleansatisfiesLiteral(a: Representation(parameter) a: {
_tag: "Number";
annotations: Schema.Annotations.Annotations | undefined;
checks: ReadonlyArray<Check<NumberMeta>>;
}
a, b: Representation(parameter) b: {
_tag: "Literal";
annotations: Schema.Annotations.Annotations | undefined;
literal: string | number | boolean | bigint;
}
b) ? { ...b: Representation(parameter) b: {
_tag: "Literal";
annotations: Schema.Annotations.Annotations | undefined;
literal: string | number | boolean | bigint;
}
b, ...function combineAnnotations(
a: Schema.Annotations.Annotations | undefined,
b: Schema.Annotations.Annotations | undefined
):
| {
annotations: Schema.Annotations.Annotations
}
| undefined
combineAnnotations(a: Representation(parameter) a: {
_tag: "Number";
annotations: Schema.Annotations.Annotations | undefined;
checks: ReadonlyArray<Check<NumberMeta>>;
}
a.Number.annotations?: anyannotations, b: Representation(parameter) b: {
_tag: "Literal";
annotations: Schema.Annotations.Annotations | undefined;
literal: string | number | boolean | bigint;
}
b.Literal.annotations?: anyannotations) } : const never: Neverconst never: {
_tag: "Never";
annotations: Schema.Annotations.Annotations | undefined;
}
never
}
if (b: Representationb._tag: | "Declaration"
| "Suspend"
| "Null"
| "Undefined"
| "Void"
| "Never"
| "Any"
| "String"
| "Number"
| "Boolean"
| "BigInt"
| "Symbol"
| "UniqueSymbol"
| "ObjectKeyword"
| "Enum"
| "TemplateLiteral"
| "Arrays"
| "Objects"
_tag !== "Number") return const never: Neverconst never: {
_tag: "Never";
annotations: Schema.Annotations.Annotations | undefined;
}
never
const const checks: Check<any>[] | undefinedchecks = function combineNumberChecks(
a: ReadonlyArray<Check<NumberMeta>>,
b: ReadonlyArray<Check<NumberMeta>>,
annotations:
| Schema.Annotations.Annotations
| undefined
): Array<Check<NumberMeta>> | undefined
combineNumberChecks(a: Representation(parameter) a: {
_tag: "Number";
annotations: Schema.Annotations.Annotations | undefined;
checks: ReadonlyArray<Check<NumberMeta>>;
}
a.Number.checks: ReadonlyArray<Check<NumberMeta>>checks, b: Representation(parameter) b: {
_tag: "Number";
annotations: Schema.Annotations.Annotations | undefined;
checks: ReadonlyArray<Check<NumberMeta>>;
}
b.Number.checks: ReadonlyArray<Check<NumberMeta>>checks, b: Representation(parameter) b: {
_tag: "Number";
annotations: Schema.Annotations.Annotations | undefined;
checks: ReadonlyArray<Check<NumberMeta>>;
}
b.Number.annotations?: anyannotations)
return {
Number._tag: "Number"_tag: "Number",
Number.checks: ReadonlyArray<Check<NumberMeta>>checks: const checks: Check<any>[] | undefinedchecks ?? a: Representation(parameter) a: {
_tag: "Number";
annotations: Schema.Annotations.Annotations | undefined;
checks: ReadonlyArray<Check<NumberMeta>>;
}
a.Number.checks: ReadonlyArray<Check<NumberMeta>>checks,
...function combineAnnotations(
a: Schema.Annotations.Annotations | undefined,
b: Schema.Annotations.Annotations | undefined
):
| {
annotations: Schema.Annotations.Annotations
}
| undefined
combineAnnotations(a: Representation(parameter) a: {
_tag: "Number";
annotations: Schema.Annotations.Annotations | undefined;
checks: ReadonlyArray<Check<NumberMeta>>;
}
a.Number.annotations?: anyannotations, const checks: Check<any>[] | undefinedchecks ? var undefinedundefined : b: Representation(parameter) b: {
_tag: "Number";
annotations: Schema.Annotations.Annotations | undefined;
checks: ReadonlyArray<Check<NumberMeta>>;
}
b.Number.annotations?: anyannotations)
}
}
case "Boolean":
if (b: Representationb._tag: | "Declaration"
| "Suspend"
| "Null"
| "Undefined"
| "Void"
| "Never"
| "Any"
| "String"
| "Number"
| "Boolean"
| "BigInt"
| "Symbol"
| "Literal"
| "UniqueSymbol"
| "ObjectKeyword"
| "Enum"
| "TemplateLiteral"
| "Arrays"
| "Objects"
_tag === "Boolean") {
return { Boolean._tag: "Boolean"_tag: "Boolean", ...function combineAnnotations(
a: Schema.Annotations.Annotations | undefined,
b: Schema.Annotations.Annotations | undefined
):
| {
annotations: Schema.Annotations.Annotations
}
| undefined
combineAnnotations(a: Representation(parameter) a: {
_tag: "Boolean";
annotations: Schema.Annotations.Annotations | undefined;
}
a.Boolean.annotations?: anyannotations, b: Representation(parameter) b: {
_tag: "Boolean";
annotations: Schema.Annotations.Annotations | undefined;
}
b.Boolean.annotations?: anyannotations) }
}
return b: Representationb._tag: | "Declaration"
| "Suspend"
| "Null"
| "Undefined"
| "Void"
| "Never"
| "Any"
| "String"
| "Number"
| "BigInt"
| "Symbol"
| "Literal"
| "UniqueSymbol"
| "ObjectKeyword"
| "Enum"
| "TemplateLiteral"
| "Arrays"
| "Objects"
_tag === "Literal" && typeof b: Representation(parameter) b: {
_tag: "Literal";
annotations: Schema.Annotations.Annotations | undefined;
literal: string | number | boolean | bigint;
}
b.Literal.literal: string | number | bigint | booleanliteral === "boolean"
? { ...b: Representation(parameter) b: {
_tag: "Literal";
annotations: Schema.Annotations.Annotations | undefined;
literal: string | number | boolean | bigint;
}
b, ...function combineAnnotations(
a: Schema.Annotations.Annotations | undefined,
b: Schema.Annotations.Annotations | undefined
):
| {
annotations: Schema.Annotations.Annotations
}
| undefined
combineAnnotations(a: Representation(parameter) a: {
_tag: "Boolean";
annotations: Schema.Annotations.Annotations | undefined;
}
a.Boolean.annotations?: anyannotations, b: Representation(parameter) b: {
_tag: "Literal";
annotations: Schema.Annotations.Annotations | undefined;
literal: string | number | boolean | bigint;
}
b.Literal.annotations?: anyannotations) }
: const never: Neverconst never: {
_tag: "Never";
annotations: Schema.Annotations.Annotations | undefined;
}
never
case "Literal":
switch (b: Representationb._tag: | "Declaration"
| "Suspend"
| "Null"
| "Undefined"
| "Void"
| "Never"
| "Any"
| "String"
| "Number"
| "Boolean"
| "BigInt"
| "Symbol"
| "Literal"
| "UniqueSymbol"
| "ObjectKeyword"
| "Enum"
| "TemplateLiteral"
| "Arrays"
| "Objects"
_tag) {
case "Literal":
return a: Representation(parameter) a: {
_tag: "Literal";
annotations: Schema.Annotations.Annotations | undefined;
literal: string | number | boolean | bigint;
}
a.Literal.literal: string | number | bigint | booleanliteral === b: Representation(parameter) b: {
_tag: "Literal";
annotations: Schema.Annotations.Annotations | undefined;
literal: string | number | boolean | bigint;
}
b.Literal.literal: string | number | bigint | booleanliteral
? { ...a: Representation(parameter) a: {
_tag: "Literal";
annotations: Schema.Annotations.Annotations | undefined;
literal: string | number | boolean | bigint;
}
a, ...function combineAnnotations(
a: Schema.Annotations.Annotations | undefined,
b: Schema.Annotations.Annotations | undefined
):
| {
annotations: Schema.Annotations.Annotations
}
| undefined
combineAnnotations(a: Representation(parameter) a: {
_tag: "Literal";
annotations: Schema.Annotations.Annotations | undefined;
literal: string | number | boolean | bigint;
}
a.Literal.annotations?: anyannotations, b: Representation(parameter) b: {
_tag: "Literal";
annotations: Schema.Annotations.Annotations | undefined;
literal: string | number | boolean | bigint;
}
b.Literal.annotations?: anyannotations) }
: const never: Neverconst never: {
_tag: "Never";
annotations: Schema.Annotations.Annotations | undefined;
}
never
case "String":
case "Number":
return function (local function) satisfiesLiteral(type: String | Number, literal: Literal): booleansatisfiesLiteral(b: Representationb, a: Representation(parameter) a: {
_tag: "Literal";
annotations: Schema.Annotations.Annotations | undefined;
literal: string | number | boolean | bigint;
}
a) ? { ...a: Representation(parameter) a: {
_tag: "Literal";
annotations: Schema.Annotations.Annotations | undefined;
literal: string | number | boolean | bigint;
}
a, ...function combineAnnotations(
a: Schema.Annotations.Annotations | undefined,
b: Schema.Annotations.Annotations | undefined
):
| {
annotations: Schema.Annotations.Annotations
}
| undefined
combineAnnotations(a: Representation(parameter) a: {
_tag: "Literal";
annotations: Schema.Annotations.Annotations | undefined;
literal: string | number | boolean | bigint;
}
a.Literal.annotations?: anyannotations, b: Representationb.annotations?: anyannotations) } : const never: Neverconst never: {
_tag: "Never";
annotations: Schema.Annotations.Annotations | undefined;
}
never
case "Boolean":
return typeof a: Representation(parameter) a: {
_tag: "Literal";
annotations: Schema.Annotations.Annotations | undefined;
literal: string | number | boolean | bigint;
}
a.Literal.literal: string | number | bigint | booleanliteral === "boolean"
? { ...a: Representation(parameter) a: {
_tag: "Literal";
annotations: Schema.Annotations.Annotations | undefined;
literal: string | number | boolean | bigint;
}
a, ...function combineAnnotations(
a: Schema.Annotations.Annotations | undefined,
b: Schema.Annotations.Annotations | undefined
):
| {
annotations: Schema.Annotations.Annotations
}
| undefined
combineAnnotations(a: Representation(parameter) a: {
_tag: "Literal";
annotations: Schema.Annotations.Annotations | undefined;
literal: string | number | boolean | bigint;
}
a.Literal.annotations?: anyannotations, b: Representation(parameter) b: {
_tag: "Boolean";
annotations: Schema.Annotations.Annotations | undefined;
}
b.Boolean.annotations?: anyannotations) }
: const never: Neverconst never: {
_tag: "Never";
annotations: Schema.Annotations.Annotations | undefined;
}
never
default:
return const never: Neverconst never: {
_tag: "Never";
annotations: Schema.Annotations.Annotations | undefined;
}
never
}
case "Arrays": {
if (b: Representationb._tag: | "Declaration"
| "Suspend"
| "Null"
| "Undefined"
| "Void"
| "Never"
| "Any"
| "String"
| "Number"
| "Boolean"
| "BigInt"
| "Symbol"
| "Literal"
| "UniqueSymbol"
| "ObjectKeyword"
| "Enum"
| "TemplateLiteral"
| "Arrays"
| "Objects"
_tag !== "Arrays") return const never: Neverconst never: {
_tag: "Never";
annotations: Schema.Annotations.Annotations | undefined;
}
never
const const arrays:
| Pick<Arrays, "elements" | "rest">
| undefined
arrays = function (local function) combineArrays(a: Arrays, b: Arrays): Pick<Arrays, 'elements' | 'rest'> | undefinedcombineArrays(a: Representation(parameter) a: {
_tag: "Arrays";
annotations: Schema.Annotations.Annotations | undefined;
elements: ReadonlyArray<Element>;
rest: ReadonlyArray<Representation>;
checks: ReadonlyArray<Check<ArraysMeta>>;
}
a, b: Representation(parameter) b: {
_tag: "Arrays";
annotations: Schema.Annotations.Annotations | undefined;
elements: ReadonlyArray<Element>;
rest: ReadonlyArray<Representation>;
checks: ReadonlyArray<Check<ArraysMeta>>;
}
b)
if (const arrays:
| Pick<Arrays, "elements" | "rest">
| undefined
arrays === var undefinedundefined) return const never: Neverconst never: {
_tag: "Never";
annotations: Schema.Annotations.Annotations | undefined;
}
never
const const checks: Check<any>[] | undefinedchecks = function combineArraysChecks(
a: ReadonlyArray<Check<ArraysMeta>>,
b: ReadonlyArray<Check<ArraysMeta>>,
annotations:
| Schema.Annotations.Annotations
| undefined
): Array<Check<ArraysMeta>> | undefined
combineArraysChecks(a: Representation(parameter) a: {
_tag: "Arrays";
annotations: Schema.Annotations.Annotations | undefined;
elements: ReadonlyArray<Element>;
rest: ReadonlyArray<Representation>;
checks: ReadonlyArray<Check<ArraysMeta>>;
}
a.Arrays.checks: ReadonlyArray<Check<ArraysMeta>>checks, b: Representation(parameter) b: {
_tag: "Arrays";
annotations: Schema.Annotations.Annotations | undefined;
elements: ReadonlyArray<Element>;
rest: ReadonlyArray<Representation>;
checks: ReadonlyArray<Check<ArraysMeta>>;
}
b.Arrays.checks: ReadonlyArray<Check<ArraysMeta>>checks, b: Representation(parameter) b: {
_tag: "Arrays";
annotations: Schema.Annotations.Annotations | undefined;
elements: ReadonlyArray<Element>;
rest: ReadonlyArray<Representation>;
checks: ReadonlyArray<Check<ArraysMeta>>;
}
b.Arrays.annotations?: anyannotations)
return {
Arrays._tag: "Arrays"_tag: "Arrays",
Arrays.elements: ReadonlyArray<Element>elements: const arrays: Pick<
Arrays,
"elements" | "rest"
>
arrays.elements: ReadonlyArray<Element>elements,
Arrays.rest: ReadonlyArray<Representation>rest: const arrays: Pick<
Arrays,
"elements" | "rest"
>
arrays.rest: ReadonlyArray<Representation>rest,
Arrays.checks: ReadonlyArray<Check<ArraysMeta>>checks: const checks: Check<any>[] | undefinedchecks ?? a: Representation(parameter) a: {
_tag: "Arrays";
annotations: Schema.Annotations.Annotations | undefined;
elements: ReadonlyArray<Element>;
rest: ReadonlyArray<Representation>;
checks: ReadonlyArray<Check<ArraysMeta>>;
}
a.Arrays.checks: ReadonlyArray<Check<ArraysMeta>>checks,
...function combineAnnotations(
a: Schema.Annotations.Annotations | undefined,
b: Schema.Annotations.Annotations | undefined
):
| {
annotations: Schema.Annotations.Annotations
}
| undefined
combineAnnotations(a: Representation(parameter) a: {
_tag: "Arrays";
annotations: Schema.Annotations.Annotations | undefined;
elements: ReadonlyArray<Element>;
rest: ReadonlyArray<Representation>;
checks: ReadonlyArray<Check<ArraysMeta>>;
}
a.Arrays.annotations?: anyannotations, const checks: Check<any>[] | undefinedchecks ? var undefinedundefined : b: Representation(parameter) b: {
_tag: "Arrays";
annotations: Schema.Annotations.Annotations | undefined;
elements: ReadonlyArray<Element>;
rest: ReadonlyArray<Representation>;
checks: ReadonlyArray<Check<ArraysMeta>>;
}
b.Arrays.annotations?: anyannotations)
}
}
case "Objects": {
if (b: Representationb._tag: | "Declaration"
| "Suspend"
| "Null"
| "Undefined"
| "Void"
| "Never"
| "Any"
| "String"
| "Number"
| "Boolean"
| "BigInt"
| "Symbol"
| "Literal"
| "UniqueSymbol"
| "ObjectKeyword"
| "Enum"
| "TemplateLiteral"
| "Arrays"
| "Objects"
_tag !== "Objects") return const never: Neverconst never: {
_tag: "Never";
annotations: Schema.Annotations.Annotations | undefined;
}
never
const const checks: Check<any>[] | undefinedchecks = function combineChecks<M>(
a: ReadonlyArray<Check<M>>,
b: ReadonlyArray<Check<M>>,
annotations:
| Schema.Annotations.Annotations
| undefined
): Array<Check<M>> | undefined
combineChecks(a: Representation(parameter) a: {
_tag: "Objects";
annotations: Schema.Annotations.Annotations | undefined;
propertySignatures: ReadonlyArray<PropertySignature>;
indexSignatures: ReadonlyArray<IndexSignature>;
checks: ReadonlyArray<Check<ObjectsMeta>>;
}
a.Objects.checks: ReadonlyArray<Check<ObjectsMeta>>checks, b: Representation(parameter) b: {
_tag: "Objects";
annotations: Schema.Annotations.Annotations | undefined;
propertySignatures: ReadonlyArray<PropertySignature>;
indexSignatures: ReadonlyArray<IndexSignature>;
checks: ReadonlyArray<Check<ObjectsMeta>>;
}
b.Objects.checks: ReadonlyArray<Check<ObjectsMeta>>checks, b: Representation(parameter) b: {
_tag: "Objects";
annotations: Schema.Annotations.Annotations | undefined;
propertySignatures: ReadonlyArray<PropertySignature>;
indexSignatures: ReadonlyArray<IndexSignature>;
checks: ReadonlyArray<Check<ObjectsMeta>>;
}
b.Objects.annotations?: anyannotations)
return {
Objects._tag: "Objects"_tag: "Objects",
Objects.propertySignatures: Array<PropertySignature>propertySignatures: function (local function) combinePropertySignatures(a: ReadonlyArray<PropertySignature>, b: ReadonlyArray<PropertySignature>): Array<PropertySignature>combinePropertySignatures(a: Representation(parameter) a: {
_tag: "Objects";
annotations: Schema.Annotations.Annotations | undefined;
propertySignatures: ReadonlyArray<PropertySignature>;
indexSignatures: ReadonlyArray<IndexSignature>;
checks: ReadonlyArray<Check<ObjectsMeta>>;
}
a.Objects.propertySignatures: ReadonlyArray<PropertySignature>propertySignatures, b: Representation(parameter) b: {
_tag: "Objects";
annotations: Schema.Annotations.Annotations | undefined;
propertySignatures: ReadonlyArray<PropertySignature>;
indexSignatures: ReadonlyArray<IndexSignature>;
checks: ReadonlyArray<Check<ObjectsMeta>>;
}
b.Objects.propertySignatures: ReadonlyArray<PropertySignature>propertySignatures),
Objects.indexSignatures: Array<IndexSignature>indexSignatures: function (local function) combineIndexSignatures(a: ReadonlyArray<IndexSignature>, b: ReadonlyArray<IndexSignature>): Array<IndexSignature>combineIndexSignatures(a: Representation(parameter) a: {
_tag: "Objects";
annotations: Schema.Annotations.Annotations | undefined;
propertySignatures: ReadonlyArray<PropertySignature>;
indexSignatures: ReadonlyArray<IndexSignature>;
checks: ReadonlyArray<Check<ObjectsMeta>>;
}
a.Objects.indexSignatures: ReadonlyArray<IndexSignature>indexSignatures, b: Representation(parameter) b: {
_tag: "Objects";
annotations: Schema.Annotations.Annotations | undefined;
propertySignatures: ReadonlyArray<PropertySignature>;
indexSignatures: ReadonlyArray<IndexSignature>;
checks: ReadonlyArray<Check<ObjectsMeta>>;
}
b.Objects.indexSignatures: ReadonlyArray<IndexSignature>indexSignatures),
Objects.checks: ReadonlyArray<Check<ObjectsMeta>>checks: const checks: Check<any>[] | undefinedchecks ?? a: Representation(parameter) a: {
_tag: "Objects";
annotations: Schema.Annotations.Annotations | undefined;
propertySignatures: ReadonlyArray<PropertySignature>;
indexSignatures: ReadonlyArray<IndexSignature>;
checks: ReadonlyArray<Check<ObjectsMeta>>;
}
a.Objects.checks: ReadonlyArray<Check<ObjectsMeta>>checks,
...function combineAnnotations(
a: Schema.Annotations.Annotations | undefined,
b: Schema.Annotations.Annotations | undefined
):
| {
annotations: Schema.Annotations.Annotations
}
| undefined
combineAnnotations(a: Representation(parameter) a: {
_tag: "Objects";
annotations: Schema.Annotations.Annotations | undefined;
propertySignatures: ReadonlyArray<PropertySignature>;
indexSignatures: ReadonlyArray<IndexSignature>;
checks: ReadonlyArray<Check<ObjectsMeta>>;
}
a.Objects.annotations?: anyannotations, const checks: Check<any>[] | undefinedchecks ? var undefinedundefined : b: Representation(parameter) b: {
_tag: "Objects";
annotations: Schema.Annotations.Annotations | undefined;
propertySignatures: ReadonlyArray<PropertySignature>;
indexSignatures: ReadonlyArray<IndexSignature>;
checks: ReadonlyArray<Check<ObjectsMeta>>;
}
b.Objects.annotations?: anyannotations)
}
}
default:
return const never: Neverconst never: {
_tag: "Never";
annotations: Schema.Annotations.Annotations | undefined;
}
never
}
}
function function (local function) satisfiesPrimitiveCheck(check: Check<Meta>, value: unknown): booleansatisfiesPrimitiveCheck(check: Check<Meta>check: type Check<M> = Filter<M> | FilterGroup<M>A validation constraint attached to a type. Either a single
Filter
or a
FilterGroup
combining multiple checks.
Check<type Meta = anyMeta>, value: unknownvalue: unknown): boolean {
if (check: Check<Meta>check._tag: "Filter" | "FilterGroup"_tag === "FilterGroup") {
return check: Check<Meta>(parameter) check: {
_tag: "FilterGroup";
annotations: Schema.Annotations.Filter | undefined;
checks: readonly [Check<M>, ...Array<Check<M>>];
}
check.FilterGroup<any>.checks: readonly [Check<M>, ...Array<Check<M>>](property) FilterGroup<any>.checks: {
0: Check<Meta>;
length: number;
toString: () => string;
toLocaleString: { (): string; (locales: string | string[], options?: Intl.NumberFormatOptions & Intl.DateTimeFormatOptions): string };
concat: { (...items: Array<ConcatArray<Check<Meta>>>): Array<Check<Meta>>; (...items: Array<Check<Meta> | ConcatArray<Check<Meta>>>): Array<Check<Meta>> };
join: (separator?: string) => string;
slice: (start?: number, end?: number) => Array<Check<Meta>>;
indexOf: (searchElement: Check<Meta>, fromIndex?: number) => number;
lastIndexOf: (searchElement: Check<Meta>, fromIndex?: number) => number;
every: { (predicate: (value: Check<Meta>, index: number, array: ReadonlyArray<Check<Meta>>) => value is S, thisArg?: any): this is readonly S[]; (predicate: (value: Check<Meta>, index: number, array: ReadonlyArray<Check<Meta>>) => unknown, thisAr…;
some: (predicate: (value: Check<Meta>, index: number, array: ReadonlyArray<Check<Meta>>) => unknown, thisArg?: any) => boolean;
forEach: (callbackfn: (value: Check<Meta>, index: number, array: ReadonlyArray<Check<Meta>>) => void, thisArg?: any) => void;
map: (callbackfn: (value: Check<Meta>, index: number, array: ReadonlyArray<Check<Meta>>) => U, thisArg?: any) => Array<U>;
filter: { (predicate: (value: Check<Meta>, index: number, array: ReadonlyArray<Check<Meta>>) => value is S, thisArg?: any): Array<S>; (predicate: (value: Check<Meta>, index: number, array: ReadonlyArray<Check<Meta>>) => unknown, thisArg?: any): Ar…;
reduce: { (callbackfn: (previousValue: Check<Meta>, currentValue: Check<Meta>, currentIndex: number, array: ReadonlyArray<Check<Meta>>) => Check<Meta>): Check<Meta>; (callbackfn: (previousValue: Check<Meta>, currentValue: Check<Meta>, currentIndex…;
reduceRight: { (callbackfn: (previousValue: Check<Meta>, currentValue: Check<Meta>, currentIndex: number, array: ReadonlyArray<Check<Meta>>) => Check<Meta>): Check<Meta>; (callbackfn: (previousValue: Check<Meta>, currentValue: Check<Meta>, currentIndex…;
find: { (predicate: (value: Check<Meta>, index: number, obj: ReadonlyArray<Check<Meta>>) => value is S, thisArg?: any): S | undefined; (predicate: (value: Check<Meta>, index: number, obj: ReadonlyArray<Check<Meta>>) => unknown, thisArg?: any): C…;
findIndex: (predicate: (value: Check<Meta>, index: number, obj: ReadonlyArray<Check<Meta>>) => unknown, thisArg?: any) => number;
entries: () => ArrayIterator<[number, Check<Meta>]>;
keys: () => ArrayIterator<number>;
values: () => ArrayIterator<Check<Meta>>;
includes: (searchElement: Check<Meta>, fromIndex?: number) => boolean;
flatMap: (callback: (this: This, value: Check<Meta>, index: number, array: Array<Check<Meta>>) => U | ReadonlyArray<U>, thisArg?: This | undefined) => Array<U>;
flat: (this: A, depth?: D | undefined) => Array<FlatArray<A, D>>;
at: (index: number) => Check<Meta> | undefined;
findLast: { (predicate: (value: Check<Meta>, index: number, array: ReadonlyArray<Check<Meta>>) => value is S, thisArg?: any): S | undefined; (predicate: (value: Check<Meta>, index: number, array: ReadonlyArray<Check<Meta>>) => unknown, thisArg?: any…;
findLastIndex: (predicate: (value: Check<Meta>, index: number, array: ReadonlyArray<Check<Meta>>) => unknown, thisArg?: any) => number;
toReversed: () => Array<Check<Meta>>;
toSorted: (compareFn?: ((a: Check<Meta>, b: Check<Meta>) => number) | undefined) => Array<Check<Meta>>;
toSpliced: { (start: number, deleteCount: number, ...items: Array<Check<Meta>>): Array<Check<Meta>>; (start: number, deleteCount?: number): Array<Check<Meta>> };
with: (index: number, value: Check<Meta>) => Array<Check<Meta>>;
}
checks.ReadonlyArray<Check<any>>.every(predicate: (value: Check<any>, index: number, array: readonly Check<any>[]) => unknown, thisArg?: any): boolean (+1 overload)Determines whether all the members of an array satisfy the specified test.
every((check: Check<Meta>check) => function (local function) satisfiesPrimitiveCheck(check: Check<Meta>, value: unknown): booleansatisfiesPrimitiveCheck(check: Check<Meta>check, value: unknownvalue))
}
const const meta: anymeta = check: Check<Meta>(parameter) check: {
_tag: "Filter";
annotations: Schema.Annotations.Filter | undefined;
meta: M;
}
check.Filter<any>.meta: anymeta
switch (const meta: anymeta._tag) {
case "isMinLength":
return typeof value: unknownvalue === "string" && value: stringvalue.String.length: numberReturns the length of a String object.
length >= const meta: anyconst meta: {
_tag: "isMinLength";
minLength: number;
}
meta.minLength
case "isMaxLength":
return typeof value: unknownvalue === "string" && value: stringvalue.String.length: numberReturns the length of a String object.
length <= const meta: anyconst meta: {
_tag: "isMaxLength";
maxLength: number;
}
meta.maxLength
case "isPattern":
return typeof value: unknownvalue === "string" && const meta: anyconst meta: {
_tag: "isPattern";
regExp: globalThis.RegExp;
}
meta.regExp.test(value: stringvalue)
case "isFinite":
return typeof value: unknownvalue === "number" && module globalThisglobalThis.var Number: NumberConstructorAn object that represents a number of any kind. All JavaScript numbers are 64-bit floating-point numbers.
Number.NumberConstructor.isFinite(number: unknown): booleanReturns true if passed value is finite.
Unlike the global isFinite, Number.isFinite doesn't forcibly convert the parameter to a
number. Only finite values of the type number, result in true.
isFinite(value: numbervalue)
case "isInt":
return typeof value: unknownvalue === "number" && module globalThisglobalThis.var Number: NumberConstructorAn object that represents a number of any kind. All JavaScript numbers are 64-bit floating-point numbers.
Number.NumberConstructor.isSafeInteger(number: unknown): booleanReturns true if the value passed is a safe integer.
isSafeInteger(value: numbervalue)
case "isMultipleOf":
return typeof value: unknownvalue === "number" && import remainderremainder(value: numbervalue, const meta: anyconst meta: {
_tag: "isMultipleOf";
divisor: number;
}
meta.divisor) === 0
case "isGreaterThan":
return typeof value: unknownvalue === "number" && value: numbervalue > const meta: anyconst meta: {
_tag: "isGreaterThan";
exclusiveMinimum: number;
}
meta.exclusiveMinimum
case "isGreaterThanOrEqualTo":
return typeof value: unknownvalue === "number" && value: numbervalue >= const meta: anyconst meta: {
_tag: "isGreaterThanOrEqualTo";
minimum: number;
}
meta.minimum
case "isLessThan":
return typeof value: unknownvalue === "number" && value: numbervalue < const meta: anyconst meta: {
_tag: "isLessThan";
exclusiveMaximum: number;
}
meta.exclusiveMaximum
case "isLessThanOrEqualTo":
return typeof value: unknownvalue === "number" && value: numbervalue <= const meta: anyconst meta: {
_tag: "isLessThanOrEqualTo";
maximum: number;
}
meta.maximum
default:
return false
}
}
function function (local function) satisfiesLiteral(type: String | Number, literal: Literal): booleansatisfiesLiteral(type: String | Numbertype: String | Number, literal: Literal(parameter) literal: {
_tag: "Literal";
annotations: Schema.Annotations.Annotations | undefined;
literal: string | number | boolean | bigint;
}
literal: Literal): boolean {
const const value:
| string
| number
| bigint
| boolean
value = literal: Literal(parameter) literal: {
_tag: "Literal";
annotations: Schema.Annotations.Annotations | undefined;
literal: string | number | boolean | bigint;
}
literal.Literal.literal: string | number | bigint | booleanliteral
if (type: String | Numbertype._tag: "String" | "Number"_tag === "String" ? typeof const value:
| string
| number
| bigint
| boolean
value !== "string" : typeof const value:
| string
| number
| bigint
| boolean
value !== "number") {
return false
}
return type: String | Numbertype.checks: readonly Check<any>[]checks.ReadonlyArray<Check<any>>.every(predicate: (value: Check<any>, index: number, array: readonly Check<any>[]) => unknown, thisArg?: any): boolean (+1 overload)Determines whether all the members of an array satisfy the specified test.
every((check: Check<any>check) => function (local function) satisfiesPrimitiveCheck(check: Check<Meta>, value: unknown): booleansatisfiesPrimitiveCheck(check: Check<any>check, const value:
| string
| number
| bigint
| boolean
value))
}
function function (local function) collectProperties(js: JsonSchema.JsonSchema): Array<PropertySignature>collectProperties(js: JsonSchema.JsonSchemajs: import JsonSchemaJsonSchema.type JsonSchema.JsonSchema = /*unresolved*/ anyJsonSchema): interface Array<T>Array<PropertySignature> {
const const properties: Record<string, unknown>properties: type Record<K extends keyof any, T> = {
[P in K]: T
}
Construct a type with a set of properties K of type T
Record<string, unknown> = import PredicatePredicate.isObject(js: JsonSchema.JsonSchemajs.properties) ? js: JsonSchema.JsonSchemajs.properties : {}
const const required: anyrequired = var Array: ArrayConstructorArray.ArrayConstructor.isArray(arg: any): arg is any[]isArray(js: JsonSchema.JsonSchemajs.required) ? js: JsonSchema.JsonSchemajs.required : []
const required: anyrequired.forEach((key: anykey) => {
if (!var Object: ObjectConstructorProvides functionality common to all JavaScript objects.
Object.ObjectConstructor.hasOwn(o: object, v: PropertyKey): booleanDetermines whether an object has a property with the specified name.
hasOwn(const properties: Record<string, unknown>properties, key: anykey)) {
const properties: Record<string, unknown>properties[key: anykey] = {}
}
})
return var Object: ObjectConstructorProvides functionality common to all JavaScript objects.
Object.ObjectConstructor.entries<unknown>(o: {
[s: string]: unknown;
} | ArrayLike<unknown>): [string, unknown][] (+1 overload)
Returns an array of key/values of the enumerable own properties of an object
entries(const properties: Record<string, unknown>properties).Array<[string, unknown]>.map<{
name: string;
type: Representation;
isOptional: boolean;
isMutable: false;
}>(callbackfn: (value: [string, unknown], index: number, array: [string, unknown][]) => {
name: string;
type: Representation;
isOptional: boolean;
isMutable: false;
}, thisArg?: any): {
name: string;
type: Representation;
isOptional: boolean;
isMutable: false;
}[]
Calls a defined callback function on each element of an array, and returns an array that contains the results.
map(([key: stringkey, v: unknownv]) => ({
name: stringname: key: stringkey,
type: Representationtype: function (local function) recur(u: unknown): Representationrecur(v: unknownv),
isOptional: booleanisOptional: !const required: anyrequired.includes(key: stringkey),
isMutable: falseisMutable: false
}))
}
function function (local function) collectIndexSignatures(js: JsonSchema.JsonSchema): Array<IndexSignature>collectIndexSignatures(js: JsonSchema.JsonSchemajs: import JsonSchemaJsonSchema.type JsonSchema.JsonSchema = /*unresolved*/ anyJsonSchema): interface Array<T>Array<IndexSignature> {
const const out: Array<IndexSignature>out: interface Array<T>Array<IndexSignature> = []
if (import PredicatePredicate.isObject(js: JsonSchema.JsonSchemajs.patternProperties)) {
for (const [const pattern: stringpattern, const value: unknownvalue] of var Object: ObjectConstructorProvides functionality common to all JavaScript objects.
Object.ObjectConstructor.entries<unknown>(o: {
[s: string]: unknown;
} | ArrayLike<unknown>): [string, unknown][] (+1 overload)
Returns an array of key/values of the enumerable own properties of an object
entries(js: JsonSchema.JsonSchemajs.patternProperties)) {
const out: Array<IndexSignature>out.Array<IndexSignature>.push(...items: IndexSignature[]): numberAppends new elements to the end of an array, and returns the new length of the array.
push({ IndexSignature.parameter: Representationparameter: function (local function) recur(u: unknown): Representationrecur({ pattern: stringpattern }), IndexSignature.type: Representationtype: function (local function) recur(u: unknown): Representationrecur(const value: unknownvalue) })
}
}
if (js: JsonSchema.JsonSchemajs.additionalProperties === var undefinedundefined || js: JsonSchema.JsonSchemajs.additionalProperties === true) {
const out: Array<IndexSignature>out.Array<IndexSignature>.push(...items: IndexSignature[]): numberAppends new elements to the end of an array, and returns the new length of the array.
push({ IndexSignature.parameter: String(property) IndexSignature.parameter: {
_tag: "String";
annotations: Schema.Annotations.Annotations | undefined;
checks: ReadonlyArray<Check<StringMeta>>;
contentMediaType: string | undefined;
contentSchema: Representation | undefined;
}
parameter: const string: Stringconst string: {
_tag: "String";
annotations: Schema.Annotations.Annotations | undefined;
checks: ReadonlyArray<Check<StringMeta>>;
contentMediaType: string | undefined;
contentSchema: Representation | undefined;
}
string, IndexSignature.type: Unknown(property) IndexSignature.type: {
_tag: "Unknown";
annotations: Schema.Annotations.Annotations | undefined;
}
type: const unknown: Unknownconst unknown: {
_tag: "Unknown";
annotations: Schema.Annotations.Annotations | undefined;
}
unknown })
} else if (import PredicatePredicate.isObject(js: JsonSchema.JsonSchemajs.additionalProperties)) {
const out: Array<IndexSignature>out.Array<IndexSignature>.push(...items: IndexSignature[]): numberAppends new elements to the end of an array, and returns the new length of the array.
push({ IndexSignature.parameter: String(property) IndexSignature.parameter: {
_tag: "String";
annotations: Schema.Annotations.Annotations | undefined;
checks: ReadonlyArray<Check<StringMeta>>;
contentMediaType: string | undefined;
contentSchema: Representation | undefined;
}
parameter: const string: Stringconst string: {
_tag: "String";
annotations: Schema.Annotations.Annotations | undefined;
checks: ReadonlyArray<Check<StringMeta>>;
contentMediaType: string | undefined;
contentSchema: Representation | undefined;
}
string, IndexSignature.type: Representationtype: function (local function) recur(u: unknown): Representationrecur(js: JsonSchema.JsonSchemajs.additionalProperties) })
}
return const out: Array<IndexSignature>out
}
function function (local function) combineArrays(a: Arrays, b: Arrays): Pick<Arrays, 'elements' | 'rest'> | undefinedcombineArrays(a: Arrays(parameter) a: {
_tag: "Arrays";
annotations: Schema.Annotations.Annotations | undefined;
elements: ReadonlyArray<Element>;
rest: ReadonlyArray<Representation>;
checks: ReadonlyArray<Check<ArraysMeta>>;
}
a: Arrays, b: Arrays(parameter) b: {
_tag: "Arrays";
annotations: Schema.Annotations.Annotations | undefined;
elements: ReadonlyArray<Element>;
rest: ReadonlyArray<Representation>;
checks: ReadonlyArray<Check<ArraysMeta>>;
}
b: Arrays): type Pick<T, K extends keyof T> = {
[P in K]: T[P]
}
From T, pick a set of properties whose keys are in the union K
Pick<Arrays, "elements" | "rest"> | undefined {
const const elements: Array<Element>elements: interface Array<T>Array<Element> = []
const const len: numberlen = var Math: MathAn intrinsic object that provides basic mathematics functionality and constants.
Math.Math.max(...values: number[]): numberReturns the larger of a set of supplied numeric expressions.
max(a: Arrays(parameter) a: {
_tag: "Arrays";
annotations: Schema.Annotations.Annotations | undefined;
elements: ReadonlyArray<Element>;
rest: ReadonlyArray<Representation>;
checks: ReadonlyArray<Check<ArraysMeta>>;
}
a.Arrays.elements: ReadonlyArray<Element>elements.ReadonlyArray<Element>.length: numberGets the length of the array. This is a number one higher than the highest element defined in an array.
length, b: Arrays(parameter) b: {
_tag: "Arrays";
annotations: Schema.Annotations.Annotations | undefined;
elements: ReadonlyArray<Element>;
rest: ReadonlyArray<Representation>;
checks: ReadonlyArray<Check<ArraysMeta>>;
}
b.Arrays.elements: ReadonlyArray<Element>elements.ReadonlyArray<Element>.length: numberGets the length of the array. This is a number one higher than the highest element defined in an array.
length)
for (let let i: numberi = 0; let i: numberi < const len: numberlen; let i: numberi++) {
const const ae: Elementconst ae: {
isOptional: boolean;
type: Representation;
annotations: Schema.Annotations.Annotations | undefined;
}
ae = a: Arrays(parameter) a: {
_tag: "Arrays";
annotations: Schema.Annotations.Annotations | undefined;
elements: ReadonlyArray<Element>;
rest: ReadonlyArray<Representation>;
checks: ReadonlyArray<Check<ArraysMeta>>;
}
a.Arrays.elements: ReadonlyArray<Element>elements[let i: numberi]
const const be: Elementconst be: {
isOptional: boolean;
type: Representation;
annotations: Schema.Annotations.Annotations | undefined;
}
be = b: Arrays(parameter) b: {
_tag: "Arrays";
annotations: Schema.Annotations.Annotations | undefined;
elements: ReadonlyArray<Element>;
rest: ReadonlyArray<Representation>;
checks: ReadonlyArray<Check<ArraysMeta>>;
}
b.Arrays.elements: ReadonlyArray<Element>elements[let i: numberi]
const const isOptional: booleanisOptional = const ae: Elementconst ae: {
isOptional: boolean;
type: Representation;
annotations: Schema.Annotations.Annotations | undefined;
}
ae?.Element.isOptional: booleanisOptional !== false && const be: Elementconst be: {
isOptional: boolean;
type: Representation;
annotations: Schema.Annotations.Annotations | undefined;
}
be?.Element.isOptional: booleanisOptional !== false
const const at: Representationat = const ae: Elementconst ae: {
isOptional: boolean;
type: Representation;
annotations: Schema.Annotations.Annotations | undefined;
}
ae?.Element.type: Representationtype ?? a: Arrays(parameter) a: {
_tag: "Arrays";
annotations: Schema.Annotations.Annotations | undefined;
elements: ReadonlyArray<Element>;
rest: ReadonlyArray<Representation>;
checks: ReadonlyArray<Check<ArraysMeta>>;
}
a.Arrays.rest: ReadonlyArray<Representation>rest[0]
const const bt: Representationbt = const be: Elementconst be: {
isOptional: boolean;
type: Representation;
annotations: Schema.Annotations.Annotations | undefined;
}
be?.Element.type: Representationtype ?? b: Arrays(parameter) b: {
_tag: "Arrays";
annotations: Schema.Annotations.Annotations | undefined;
elements: ReadonlyArray<Element>;
rest: ReadonlyArray<Representation>;
checks: ReadonlyArray<Check<ArraysMeta>>;
}
b.Arrays.rest: ReadonlyArray<Representation>rest[0]
if (const at: Representationat === var undefinedundefined || const bt: Representationbt === var undefinedundefined) {
return const isOptional: booleanisOptional ? { elements: Array<Element>elements, rest: readonly Representation[]rest: [] } : var undefinedundefined
}
const const type: Representationtype = function (local function) combine(a: Representation, b: Representation): Representationcombine(const at: Representationat, const bt: Representationbt)
if (const type: Representationtype === const never: Neverconst never: {
_tag: "Never";
annotations: Schema.Annotations.Annotations | undefined;
}
never) {
return const isOptional: booleanisOptional ? { elements: Array<Element>elements, rest: readonly Representation[]rest: [] } : var undefinedundefined
}
const elements: Array<Element>elements.Array<Element>.push(...items: Element[]): numberAppends new elements to the end of an array, and returns the new length of the array.
push({ Element.isOptional: booleanisOptional, Element.type: Representationtype })
}
const const ar: Representationar = a: Arrays(parameter) a: {
_tag: "Arrays";
annotations: Schema.Annotations.Annotations | undefined;
elements: ReadonlyArray<Element>;
rest: ReadonlyArray<Representation>;
checks: ReadonlyArray<Check<ArraysMeta>>;
}
a.Arrays.rest: ReadonlyArray<Representation>rest[0]
const const br: Representationbr = b: Arrays(parameter) b: {
_tag: "Arrays";
annotations: Schema.Annotations.Annotations | undefined;
elements: ReadonlyArray<Element>;
rest: ReadonlyArray<Representation>;
checks: ReadonlyArray<Check<ArraysMeta>>;
}
b.Arrays.rest: ReadonlyArray<Representation>rest[0]
if (const ar: Representationar === var undefinedundefined || const br: Representationbr === var undefinedundefined) {
return { elements: Array<Element>elements, rest: readonly Representation[]rest: [] }
}
const const rest: Representationrest = function (local function) combine(a: Representation, b: Representation): Representationcombine(const ar: Representationar, const br: Representationbr)
return { elements: Array<Element>elements, rest: Array<Representation>rest: const rest: Representationrest === const never: Neverconst never: {
_tag: "Never";
annotations: Schema.Annotations.Annotations | undefined;
}
never ? [] : [const rest: Representationrest] }
}
function function (local function) combinePropertySignatures(a: ReadonlyArray<PropertySignature>, b: ReadonlyArray<PropertySignature>): Array<PropertySignature>combinePropertySignatures(
a: ReadonlyArray<PropertySignature>a: interface ReadonlyArray<T>ReadonlyArray<PropertySignature>,
b: ReadonlyArray<PropertySignature>b: interface ReadonlyArray<T>ReadonlyArray<PropertySignature>
): interface Array<T>Array<PropertySignature> {
const const propertySignatures: Array<PropertySignature>propertySignatures: interface Array<T>Array<PropertySignature> = []
const const thatPropertiesMap: Record<
PropertyKey,
PropertySignature
>
thatPropertiesMap: type Record<K extends keyof any, T> = {
[P in K]: T
}
Construct a type with a set of properties K of type T
Record<type PropertyKey =
| string
| number
| symbol
PropertyKey, PropertySignature> = {}
for (const const p: PropertySignatureconst p: {
name: PropertyKey;
type: Representation;
isOptional: boolean;
isMutable: boolean;
annotations: Schema.Annotations.Annotations | undefined;
}
p of b: ReadonlyArray<PropertySignature>b) {
const thatPropertiesMap: Record<
PropertyKey,
PropertySignature
>
thatPropertiesMap[const p: PropertySignatureconst p: {
name: PropertyKey;
type: Representation;
isOptional: boolean;
isMutable: boolean;
annotations: Schema.Annotations.Annotations | undefined;
}
p.PropertySignature.name: PropertyKeyname] = const p: PropertySignatureconst p: {
name: PropertyKey;
type: Representation;
isOptional: boolean;
isMutable: boolean;
annotations: Schema.Annotations.Annotations | undefined;
}
p
}
const const keys: Set<PropertyKey>keys = new var Set: SetConstructor
new <PropertyKey>(iterable?: Iterable<PropertyKey> | null | undefined) => Set<PropertyKey> (+1 overload)
Set<type PropertyKey =
| string
| number
| symbol
PropertyKey>()
for (const const p: PropertySignatureconst p: {
name: PropertyKey;
type: Representation;
isOptional: boolean;
isMutable: boolean;
annotations: Schema.Annotations.Annotations | undefined;
}
p of a: ReadonlyArray<PropertySignature>a) {
const keys: Set<PropertyKey>keys.Set<PropertyKey>.add(value: PropertyKey): Set<PropertyKey>Appends a new element with a specified value to the end of the Set.
add(const p: PropertySignatureconst p: {
name: PropertyKey;
type: Representation;
isOptional: boolean;
isMutable: boolean;
annotations: Schema.Annotations.Annotations | undefined;
}
p.PropertySignature.name: PropertyKeyname)
const const thatp: PropertySignatureconst thatp: {
name: PropertyKey;
type: Representation;
isOptional: boolean;
isMutable: boolean;
annotations: Schema.Annotations.Annotations | undefined;
}
thatp = const thatPropertiesMap: Record<
PropertyKey,
PropertySignature
>
thatPropertiesMap[const p: PropertySignatureconst p: {
name: PropertyKey;
type: Representation;
isOptional: boolean;
isMutable: boolean;
annotations: Schema.Annotations.Annotations | undefined;
}
p.PropertySignature.name: PropertyKeyname]
if (const thatp: PropertySignatureconst thatp: {
name: PropertyKey;
type: Representation;
isOptional: boolean;
isMutable: boolean;
annotations: Schema.Annotations.Annotations | undefined;
}
thatp) {
const propertySignatures: Array<PropertySignature>propertySignatures.Array<PropertySignature>.push(...items: PropertySignature[]): numberAppends new elements to the end of an array, and returns the new length of the array.
push(
{
PropertySignature.name: PropertyKeyname: const p: PropertySignatureconst p: {
name: PropertyKey;
type: Representation;
isOptional: boolean;
isMutable: boolean;
annotations: Schema.Annotations.Annotations | undefined;
}
p.PropertySignature.name: PropertyKeyname,
PropertySignature.type: Representationtype: function (local function) combine(a: Representation, b: Representation): Representationcombine(const p: PropertySignatureconst p: {
name: PropertyKey;
type: Representation;
isOptional: boolean;
isMutable: boolean;
annotations: Schema.Annotations.Annotations | undefined;
}
p.PropertySignature.type: Representationtype, const thatp: PropertySignatureconst thatp: {
name: PropertyKey;
type: Representation;
isOptional: boolean;
isMutable: boolean;
annotations: Schema.Annotations.Annotations | undefined;
}
thatp.PropertySignature.type: Representationtype),
PropertySignature.isOptional: booleanisOptional: const p: PropertySignatureconst p: {
name: PropertyKey;
type: Representation;
isOptional: boolean;
isMutable: boolean;
annotations: Schema.Annotations.Annotations | undefined;
}
p.PropertySignature.isOptional: booleanisOptional && const thatp: PropertySignatureconst thatp: {
name: PropertyKey;
type: Representation;
isOptional: boolean;
isMutable: boolean;
annotations: Schema.Annotations.Annotations | undefined;
}
thatp.PropertySignature.isOptional: booleanisOptional,
PropertySignature.isMutable: booleanisMutable: const p: PropertySignatureconst p: {
name: PropertyKey;
type: Representation;
isOptional: boolean;
isMutable: boolean;
annotations: Schema.Annotations.Annotations | undefined;
}
p.PropertySignature.isMutable: booleanisMutable
}
)
} else {
const propertySignatures: Array<PropertySignature>propertySignatures.Array<PropertySignature>.push(...items: PropertySignature[]): numberAppends new elements to the end of an array, and returns the new length of the array.
push(const p: PropertySignatureconst p: {
name: PropertyKey;
type: Representation;
isOptional: boolean;
isMutable: boolean;
annotations: Schema.Annotations.Annotations | undefined;
}
p)
}
}
for (const const p: PropertySignatureconst p: {
name: PropertyKey;
type: Representation;
isOptional: boolean;
isMutable: boolean;
annotations: Schema.Annotations.Annotations | undefined;
}
p of b: ReadonlyArray<PropertySignature>b) {
if (!const keys: Set<PropertyKey>keys.Set<PropertyKey>.has(value: PropertyKey): booleanhas(const p: PropertySignatureconst p: {
name: PropertyKey;
type: Representation;
isOptional: boolean;
isMutable: boolean;
annotations: Schema.Annotations.Annotations | undefined;
}
p.PropertySignature.name: PropertyKeyname)) const propertySignatures: Array<PropertySignature>propertySignatures.Array<PropertySignature>.push(...items: PropertySignature[]): numberAppends new elements to the end of an array, and returns the new length of the array.
push(const p: PropertySignatureconst p: {
name: PropertyKey;
type: Representation;
isOptional: boolean;
isMutable: boolean;
annotations: Schema.Annotations.Annotations | undefined;
}
p)
}
return const propertySignatures: Array<PropertySignature>propertySignatures
}
function function (local function) combineIndexSignatures(a: ReadonlyArray<IndexSignature>, b: ReadonlyArray<IndexSignature>): Array<IndexSignature>combineIndexSignatures(
a: ReadonlyArray<IndexSignature>a: interface ReadonlyArray<T>ReadonlyArray<IndexSignature>,
b: ReadonlyArray<IndexSignature>b: interface ReadonlyArray<T>ReadonlyArray<IndexSignature>
): interface Array<T>Array<IndexSignature> {
if (a: ReadonlyArray<IndexSignature>a.ReadonlyArray<T>.length: numberGets the length of the array. This is a number one higher than the highest element defined in an array.
length === 0 || b: ReadonlyArray<IndexSignature>b.ReadonlyArray<T>.length: numberGets the length of the array. This is a number one higher than the highest element defined in an array.
length === 0) return []
const const out: Array<IndexSignature>out: interface Array<T>Array<IndexSignature> = [...a: ReadonlyArray<IndexSignature>a]
for (const const is: IndexSignatureconst is: {
parameter: Representation;
type: Representation;
}
is of b: ReadonlyArray<IndexSignature>b) {
if (const is: IndexSignatureconst is: {
parameter: Representation;
type: Representation;
}
is.IndexSignature.parameter: Representationparameter === const string: Stringconst string: {
_tag: "String";
annotations: Schema.Annotations.Annotations | undefined;
checks: ReadonlyArray<Check<StringMeta>>;
contentMediaType: string | undefined;
contentSchema: Representation | undefined;
}
string) {
const const i: numberi = a: ReadonlyArray<IndexSignature>a.ReadonlyArray<IndexSignature>.findIndex(predicate: (value: IndexSignature, index: number, obj: readonly IndexSignature[]) => unknown, thisArg?: any): numberReturns the index of the first element in the array where predicate is true, and -1
otherwise.
findIndex((is: IndexSignature(parameter) is: {
parameter: Representation;
type: Representation;
}
is) => is: IndexSignature(parameter) is: {
parameter: Representation;
type: Representation;
}
is.IndexSignature.parameter: Representationparameter === const string: Stringconst string: {
_tag: "String";
annotations: Schema.Annotations.Annotations | undefined;
checks: ReadonlyArray<Check<StringMeta>>;
contentMediaType: string | undefined;
contentSchema: Representation | undefined;
}
string)
if (const i: numberi !== -1) {
const out: Array<IndexSignature>out[const i: numberi] = { IndexSignature.parameter: String(property) IndexSignature.parameter: {
_tag: "String";
annotations: Schema.Annotations.Annotations | undefined;
checks: ReadonlyArray<Check<StringMeta>>;
contentMediaType: string | undefined;
contentSchema: Representation | undefined;
}
parameter: const string: Stringconst string: {
_tag: "String";
annotations: Schema.Annotations.Annotations | undefined;
checks: ReadonlyArray<Check<StringMeta>>;
contentMediaType: string | undefined;
contentSchema: Representation | undefined;
}
string, IndexSignature.type: Representationtype: function (local function) combine(a: Representation, b: Representation): Representationcombine(a: ReadonlyArray<IndexSignature>a[const i: numberi].IndexSignature.type: Representationtype, const is: IndexSignatureconst is: {
parameter: Representation;
type: Representation;
}
is.IndexSignature.type: Representationtype) }
} else {
const out: Array<IndexSignature>out.Array<IndexSignature>.push(...items: IndexSignature[]): numberAppends new elements to the end of an array, and returns the new length of the array.
push(const is: IndexSignatureconst is: {
parameter: Representation;
type: Representation;
}
is)
}
} else {
const out: Array<IndexSignature>out.Array<IndexSignature>.push(...items: IndexSignature[]): numberAppends new elements to the end of an array, and returns the new length of the array.
push(const is: IndexSignatureconst is: {
parameter: Representation;
type: Representation;
}
is)
}
}
return const out: Array<IndexSignature>out
}
function function (local function) unknownToJson(representation: Representation): RepresentationunknownToJson(representation: Representationrepresentation: type Representation =
| Declaration
| Reference
| Suspend
| Null
| Undefined
| Void
| Never
| Unknown
| Any
| String
| Number
| Boolean
| BigInt
| Symbol
| Literal
| UniqueSymbol
| ObjectKeyword
| Enum
| TemplateLiteral
| Arrays
| Objects
| Union
The core tagged union of all supported schema shapes.
Details
Each variant has a _tag discriminator. Switch on _tag to handle each
shape. Most variants carry optional annotations and some carry checks
for validation constraints.
Representation): type Representation =
| Declaration
| Reference
| Suspend
| Null
| Undefined
| Void
| Never
| Unknown
| Any
| String
| Number
| Boolean
| BigInt
| Symbol
| Literal
| UniqueSymbol
| ObjectKeyword
| Enum
| TemplateLiteral
| Arrays
| Objects
| Union
The core tagged union of all supported schema shapes.
Details
Each variant has a _tag discriminator. Switch on _tag to handle each
shape. Most variants carry optional annotations and some carry checks
for validation constraints.
Representation {
switch (representation: Representationrepresentation._tag: | "Declaration"
| "Suspend"
| "Reference"
| "Null"
| "Undefined"
| "Void"
| "Never"
| "Unknown"
| "Any"
| "String"
| "Number"
| "Boolean"
| "BigInt"
| "Symbol"
| "Literal"
| "UniqueSymbol"
| "ObjectKeyword"
| "Enum"
| "TemplateLiteral"
| "Arrays"
| "Objects"
| "Union"
_tag) {
case "Unknown":
return representation: Representation(parameter) representation: {
_tag: "Unknown";
annotations: Schema.Annotations.Annotations | undefined;
}
representation.Unknown.annotations?: anyannotations === var undefinedundefined ?
const json: Declarationconst json: {
_tag: "Declaration";
annotations: Schema.Annotations.Annotations | undefined;
typeParameters: ReadonlyArray<Representation>;
checks: ReadonlyArray<Check<DeclarationMeta>>;
encodedSchema: Representation;
}
json :
{
...const json: Declarationconst json: {
_tag: "Declaration";
annotations: Schema.Annotations.Annotations | undefined;
typeParameters: ReadonlyArray<Representation>;
checks: ReadonlyArray<Check<DeclarationMeta>>;
encodedSchema: Representation;
}
json,
annotations: anyannotations: {
...const json: Declarationconst json: {
_tag: "Declaration";
annotations: Schema.Annotations.Annotations | undefined;
typeParameters: ReadonlyArray<Representation>;
checks: ReadonlyArray<Check<DeclarationMeta>>;
encodedSchema: Representation;
}
json.Declaration.annotations?: anyannotations,
...representation: Representation(parameter) representation: {
_tag: "Unknown";
annotations: Schema.Annotations.Annotations | undefined;
}
representation.Unknown.annotations?: anyannotations
}
}
case "Suspend": {
const const thunk: Representationthunk = function (local function) unknownToJson(representation: Representation): RepresentationunknownToJson(representation: Representation(parameter) representation: {
_tag: "Suspend";
annotations: Schema.Annotations.Annotations | undefined;
checks: readonly [];
thunk: Representation;
}
representation.Suspend.thunk: Representationthunk)
return const thunk: Representationthunk === representation: Representation(parameter) representation: {
_tag: "Suspend";
annotations: Schema.Annotations.Annotations | undefined;
checks: readonly [];
thunk: Representation;
}
representation.Suspend.thunk: Representationthunk ? representation: Representation(parameter) representation: {
_tag: "Suspend";
annotations: Schema.Annotations.Annotations | undefined;
checks: readonly [];
thunk: Representation;
}
representation : { ...representation: Representation(parameter) representation: {
_tag: "Suspend";
annotations: Schema.Annotations.Annotations | undefined;
checks: readonly [];
thunk: Representation;
}
representation, Suspend.thunk: Representationthunk }
}
case "String": {
if (representation: Representation(parameter) representation: {
_tag: "String";
annotations: Schema.Annotations.Annotations | undefined;
checks: ReadonlyArray<Check<StringMeta>>;
contentMediaType: string | undefined;
contentSchema: Representation | undefined;
}
representation.String.contentSchema?: Representation | undefinedcontentSchema === var undefinedundefined) return representation: Representation(parameter) representation: {
_tag: "String";
annotations: Schema.Annotations.Annotations | undefined;
checks: ReadonlyArray<Check<StringMeta>>;
contentMediaType: string | undefined;
contentSchema: Representation | undefined;
}
representation
const const contentSchema: RepresentationcontentSchema = function (local function) unknownToJson(representation: Representation): RepresentationunknownToJson(representation: Representation(parameter) representation: {
_tag: "String";
annotations: Schema.Annotations.Annotations | undefined;
checks: ReadonlyArray<Check<StringMeta>>;
contentMediaType: string | undefined;
contentSchema: Representation | undefined;
}
representation.String.contentSchema?: Representation | undefinedcontentSchema)
return const contentSchema: RepresentationcontentSchema === representation: Representation(parameter) representation: {
_tag: "String";
annotations: Schema.Annotations.Annotations | undefined;
checks: ReadonlyArray<Check<StringMeta>>;
contentMediaType: string | undefined;
contentSchema: Representation | undefined;
}
representation.String.contentSchema?: Representation | undefinedcontentSchema ? representation: Representation(parameter) representation: {
_tag: "String";
annotations: Schema.Annotations.Annotations | undefined;
checks: ReadonlyArray<Check<StringMeta>>;
contentMediaType: string | undefined;
contentSchema: Representation | undefined;
}
representation : { ...representation: Representation(parameter) representation: {
_tag: "String";
annotations: Schema.Annotations.Annotations | undefined;
checks: ReadonlyArray<Check<StringMeta>>;
contentMediaType: string | undefined;
contentSchema: Representation | undefined;
}
representation, String.contentSchema?: RepresentationcontentSchema }
}
case "Arrays": {
const const elements: ReadonlyArray<Element>elements = import SchemaASTSchemaAST.mapOrSame(representation: Representation(parameter) representation: {
_tag: "Arrays";
annotations: Schema.Annotations.Annotations | undefined;
elements: ReadonlyArray<Element>;
rest: ReadonlyArray<Representation>;
checks: ReadonlyArray<Check<ArraysMeta>>;
}
representation.Arrays.elements: ReadonlyArray<Element>elements, (element: Element(parameter) element: {
isOptional: boolean;
type: Representation;
annotations: Schema.Annotations.Annotations | undefined;
}
element) => {
const const type: Representationtype = function (local function) unknownToJson(representation: Representation): RepresentationunknownToJson(element: Element(parameter) element: {
isOptional: boolean;
type: Representation;
annotations: Schema.Annotations.Annotations | undefined;
}
element.type)
return const type: Representationtype === element: Element(parameter) element: {
isOptional: boolean;
type: Representation;
annotations: Schema.Annotations.Annotations | undefined;
}
element.type ? element: Element(parameter) element: {
isOptional: boolean;
type: Representation;
annotations: Schema.Annotations.Annotations | undefined;
}
element : { ...element: Element(parameter) element: {
isOptional: boolean;
type: Representation;
annotations: Schema.Annotations.Annotations | undefined;
}
element, type: Representationtype }
})
const const rest: ReadonlyArray<Representation>rest = import SchemaASTSchemaAST.mapOrSame(representation: Representation(parameter) representation: {
_tag: "Arrays";
annotations: Schema.Annotations.Annotations | undefined;
elements: ReadonlyArray<Element>;
rest: ReadonlyArray<Representation>;
checks: ReadonlyArray<Check<ArraysMeta>>;
}
representation.Arrays.rest: ReadonlyArray<Representation>rest, function (local function) unknownToJson(representation: Representation): RepresentationunknownToJson)
return const elements: ReadonlyArray<Element>elements === representation: Representation(parameter) representation: {
_tag: "Arrays";
annotations: Schema.Annotations.Annotations | undefined;
elements: ReadonlyArray<Element>;
rest: ReadonlyArray<Representation>;
checks: ReadonlyArray<Check<ArraysMeta>>;
}
representation.Arrays.elements: ReadonlyArray<Element>elements && const rest: ReadonlyArray<Representation>rest === representation: Representation(parameter) representation: {
_tag: "Arrays";
annotations: Schema.Annotations.Annotations | undefined;
elements: ReadonlyArray<Element>;
rest: ReadonlyArray<Representation>;
checks: ReadonlyArray<Check<ArraysMeta>>;
}
representation.Arrays.rest: ReadonlyArray<Representation>rest ?
representation: Representation(parameter) representation: {
_tag: "Arrays";
annotations: Schema.Annotations.Annotations | undefined;
elements: ReadonlyArray<Element>;
rest: ReadonlyArray<Representation>;
checks: ReadonlyArray<Check<ArraysMeta>>;
}
representation :
{ ...representation: Representation(parameter) representation: {
_tag: "Arrays";
annotations: Schema.Annotations.Annotations | undefined;
elements: ReadonlyArray<Element>;
rest: ReadonlyArray<Representation>;
checks: ReadonlyArray<Check<ArraysMeta>>;
}
representation, Arrays.elements: ReadonlyArray<Element>elements, Arrays.rest: ReadonlyArray<Representation>rest }
}
case "Objects": {
const const propertySignatures: ReadonlyArray<PropertySignature>propertySignatures = import SchemaASTSchemaAST.mapOrSame(representation: Representation(parameter) representation: {
_tag: "Objects";
annotations: Schema.Annotations.Annotations | undefined;
propertySignatures: ReadonlyArray<PropertySignature>;
indexSignatures: ReadonlyArray<IndexSignature>;
checks: ReadonlyArray<Check<ObjectsMeta>>;
}
representation.Objects.propertySignatures: ReadonlyArray<PropertySignature>propertySignatures, (propertySignature: PropertySignature(parameter) propertySignature: {
name: PropertyKey;
type: Representation;
isOptional: boolean;
isMutable: boolean;
annotations: Schema.Annotations.Annotations | undefined;
}
propertySignature) => {
const const type: Representationtype = function (local function) unknownToJson(representation: Representation): RepresentationunknownToJson(propertySignature: PropertySignature(parameter) propertySignature: {
name: PropertyKey;
type: Representation;
isOptional: boolean;
isMutable: boolean;
annotations: Schema.Annotations.Annotations | undefined;
}
propertySignature.type)
return const type: Representationtype === propertySignature: PropertySignature(parameter) propertySignature: {
name: PropertyKey;
type: Representation;
isOptional: boolean;
isMutable: boolean;
annotations: Schema.Annotations.Annotations | undefined;
}
propertySignature.type ? propertySignature: PropertySignature(parameter) propertySignature: {
name: PropertyKey;
type: Representation;
isOptional: boolean;
isMutable: boolean;
annotations: Schema.Annotations.Annotations | undefined;
}
propertySignature : { ...propertySignature: PropertySignature(parameter) propertySignature: {
name: PropertyKey;
type: Representation;
isOptional: boolean;
isMutable: boolean;
annotations: Schema.Annotations.Annotations | undefined;
}
propertySignature, type: Representationtype }
})
const const indexSignatures: ReadonlyArray<IndexSignature>indexSignatures = import SchemaASTSchemaAST.mapOrSame(representation: Representation(parameter) representation: {
_tag: "Objects";
annotations: Schema.Annotations.Annotations | undefined;
propertySignatures: ReadonlyArray<PropertySignature>;
indexSignatures: ReadonlyArray<IndexSignature>;
checks: ReadonlyArray<Check<ObjectsMeta>>;
}
representation.Objects.indexSignatures: ReadonlyArray<IndexSignature>indexSignatures, (indexSignature: IndexSignature(parameter) indexSignature: {
parameter: Representation;
type: Representation;
}
indexSignature) => {
const const type: Representationtype = function (local function) unknownToJson(representation: Representation): RepresentationunknownToJson(indexSignature: IndexSignature(parameter) indexSignature: {
parameter: Representation;
type: Representation;
}
indexSignature.type)
return const type: Representationtype === indexSignature: IndexSignature(parameter) indexSignature: {
parameter: Representation;
type: Representation;
}
indexSignature.type ? indexSignature: IndexSignature(parameter) indexSignature: {
parameter: Representation;
type: Representation;
}
indexSignature : { ...indexSignature: IndexSignature(parameter) indexSignature: {
parameter: Representation;
type: Representation;
}
indexSignature, type: Representationtype }
})
return const propertySignatures: ReadonlyArray<PropertySignature>propertySignatures === representation: Representation(parameter) representation: {
_tag: "Objects";
annotations: Schema.Annotations.Annotations | undefined;
propertySignatures: ReadonlyArray<PropertySignature>;
indexSignatures: ReadonlyArray<IndexSignature>;
checks: ReadonlyArray<Check<ObjectsMeta>>;
}
representation.Objects.propertySignatures: ReadonlyArray<PropertySignature>propertySignatures &&
const indexSignatures: ReadonlyArray<IndexSignature>indexSignatures === representation: Representation(parameter) representation: {
_tag: "Objects";
annotations: Schema.Annotations.Annotations | undefined;
propertySignatures: ReadonlyArray<PropertySignature>;
indexSignatures: ReadonlyArray<IndexSignature>;
checks: ReadonlyArray<Check<ObjectsMeta>>;
}
representation.Objects.indexSignatures: ReadonlyArray<IndexSignature>indexSignatures ?
representation: Representation(parameter) representation: {
_tag: "Objects";
annotations: Schema.Annotations.Annotations | undefined;
propertySignatures: ReadonlyArray<PropertySignature>;
indexSignatures: ReadonlyArray<IndexSignature>;
checks: ReadonlyArray<Check<ObjectsMeta>>;
}
representation :
{ ...representation: Representation(parameter) representation: {
_tag: "Objects";
annotations: Schema.Annotations.Annotations | undefined;
propertySignatures: ReadonlyArray<PropertySignature>;
indexSignatures: ReadonlyArray<IndexSignature>;
checks: ReadonlyArray<Check<ObjectsMeta>>;
}
representation, Objects.propertySignatures: ReadonlyArray<PropertySignature>propertySignatures, Objects.indexSignatures: ReadonlyArray<IndexSignature>indexSignatures }
}
case "Union": {
const const types: ReadonlyArray<Representation>types = import SchemaASTSchemaAST.mapOrSame(representation: Representation(parameter) representation: {
_tag: "Union";
annotations: Schema.Annotations.Annotations | undefined;
types: ReadonlyArray<Representation>;
mode: "anyOf" | "oneOf";
}
representation.Union.types: ReadonlyArray<Representation>types, function (local function) unknownToJson(representation: Representation): RepresentationunknownToJson)
return const types: ReadonlyArray<Representation>types === representation: Representation(parameter) representation: {
_tag: "Union";
annotations: Schema.Annotations.Annotations | undefined;
types: ReadonlyArray<Representation>;
mode: "anyOf" | "oneOf";
}
representation.Union.types: ReadonlyArray<Representation>types ? representation: Representation(parameter) representation: {
_tag: "Union";
annotations: Schema.Annotations.Annotations | undefined;
types: ReadonlyArray<Representation>;
mode: "anyOf" | "oneOf";
}
representation : { ...representation: Representation(parameter) representation: {
_tag: "Union";
annotations: Schema.Annotations.Annotations | undefined;
types: ReadonlyArray<Representation>;
mode: "anyOf" | "oneOf";
}
representation, Union.types: ReadonlyArray<Representation>types }
}
default:
return representation: Representationrepresentation
}
}
}