OpenApiJsonSchema overview
Added in v1.0.0
Table of contents
- encoding
- model
- Annotations (interface)
- Any (interface)
- AnyObject (interface)
- AnyOf (interface)
- Array (interface)
- Boolean (interface)
- Empty (interface)
- Enum (interface)
- Enums (interface)
- Integer (interface)
- JsonSchema (type alias)
- Never (interface)
- Number (interface)
- Numeric (interface)
- Object (interface)
- Ref (interface)
- Root (type alias)
- String (interface)
- Unknown (interface)
- Void (interface)
encoding
make
Signature
export declare const make: <A, I, R>(schema: Schema.Schema<A, I, R>) => Root
Added in v1.0.0
makeWithDefs
Creates a schema with additional options and definitions.
defs
: A record of definitions that are included in the schema.defsPath
: The path to the definitions within the schema (defaults to “#/$defs/”).topLevelReferenceStrategy
: Controls the handling of the top-level reference. Possible values are:"keep"
: Keep the top-level reference (default behavior)."skip"
: Skip the top-level reference.
Signature
export declare const makeWithDefs: <A, I, R>(
schema: Schema.Schema<A, I, R>,
options: {
readonly defs: Record<string, any>
readonly defsPath?: string
readonly topLevelReferenceStrategy?: "skip" | "keep"
}
) => JsonSchema
Added in v1.0.0
model
Annotations (interface)
Signature
export interface Annotations {
title?: string
description?: string
default?: unknown
examples?: globalThis.Array<unknown>
}
Added in v1.0.0
Any (interface)
Signature
export interface Any extends Annotations {
$id: "/schemas/any"
}
Added in v1.0.0
AnyObject (interface)
Signature
export interface AnyObject extends Annotations {
$id: "/schemas/object"
anyOf: [{ type: "object" }, { type: "array" }]
nullable?: boolean
}
Added in v0.71.0
AnyOf (interface)
Signature
export interface AnyOf extends Annotations {
anyOf: globalThis.Array<JsonSchema>
nullable?: boolean
}
Added in v1.0.0
Array (interface)
Signature
export interface Array extends Annotations {
type: "array"
items?: JsonSchema | globalThis.Array<JsonSchema>
minItems?: number
maxItems?: number
additionalItems?: JsonSchema | boolean
nullable?: boolean
}
Added in v1.0.0
Boolean (interface)
Signature
export interface Boolean extends Annotations {
type: "boolean"
nullable?: boolean
}
Added in v1.0.0
Empty (interface)
Signature
export interface Empty extends Annotations {
$id: "/schemas/{}"
anyOf: [{ type: "object" }, { type: "array" }]
nullable?: boolean
}
Added in v0.71.0
Enum (interface)
Signature
export interface Enum extends Annotations {
type?: "string" | "number" | "boolean"
enum: globalThis.Array<string | number | boolean | null>
nullable?: boolean
}
Added in v1.0.0
Enums (interface)
Signature
export interface Enums extends Annotations {
$comment: "/schemas/enums"
anyOf: globalThis.Array<{
type: "string" | "number"
title: string
enum: [string | number]
}>
nullable?: boolean
}
Added in v0.71.0
Integer (interface)
Signature
export interface Integer extends Numeric {
type: "integer"
}
Added in v1.0.0
JsonSchema (type alias)
Signature
export type JsonSchema =
| Never
| Any
| Unknown
| Void
| AnyObject
| Empty
| Ref
| String
| Number
| Integer
| Boolean
| Array
| Enum
| Enums
| AnyOf
| Object
Added in v0.71.0
Never (interface)
Signature
export interface Never extends Annotations {
$id: "/schemas/never"
not: {}
nullable?: boolean
}
Added in v1.0.0
Number (interface)
Signature
export interface Number extends Numeric {
type: "number"
}
Added in v1.0.0
Numeric (interface)
Signature
export interface Numeric extends Annotations {
minimum?: number
exclusiveMinimum?: number
maximum?: number
exclusiveMaximum?: number
multipleOf?: number
format?: string
allOf?: globalThis.Array<{
minimum?: number
exclusiveMinimum?: number
maximum?: number
exclusiveMaximum?: number
multipleOf?: number
}>
nullable?: boolean
}
Added in v1.0.0
Object (interface)
Signature
export interface Object extends Annotations {
type: "object"
required: globalThis.Array<string>
properties: Record<string, JsonSchema>
additionalProperties?: boolean | JsonSchema
patternProperties?: Record<string, JsonSchema>
propertyNames?: JsonSchema
nullable?: boolean
}
Added in v1.0.0
Ref (interface)
Signature
export interface Ref extends Annotations {
$ref: string
nullable?: boolean
}
Added in v1.0.0
Root (type alias)
Signature
export type Root = JsonSchema & {
$defs?: Record<string, JsonSchema>
}
Added in v1.0.0
String (interface)
Signature
export interface String extends Annotations {
type: "string"
minLength?: number
maxLength?: number
pattern?: string
format?: string
contentMediaType?: string
contentSchema?: JsonSchema
allOf?: globalThis.Array<{
minLength?: number
maxLength?: number
pattern?: string
}>
nullable?: boolean
}
Added in v1.0.0
Unknown (interface)
Signature
export interface Unknown extends Annotations {
$id: "/schemas/unknown"
}
Added in v1.0.0
Void (interface)
Signature
export interface Void extends Annotations {
$id: "/schemas/void"
}
Added in v0.69.0