Skip to main content Link Search Menu Expand Document (external link)

OpenApiJsonSchema overview

Added in v1.0.0


Table of contents


encoding

make

Signature

export declare const make: <A, I, R>(schema: Schema.Schema<A, I, R>) => Root

Added in v1.0.0

makeWithDefs

Signature

export declare const makeWithDefs: <A, I, R>(
  schema: Schema.Schema<A, I, R>,
  options: { readonly defs: Record<string, any>; readonly defsPath?: string }
) => Root

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" }]
}

Added in v0.71.0

AnyOf (interface)

Signature

export interface AnyOf extends Annotations {
  anyOf: globalThis.Array<JsonSchema>
}

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
}

Added in v1.0.0

Boolean (interface)

Signature

export interface Boolean extends Annotations {
  type: "boolean"
}

Added in v1.0.0

Empty (interface)

Signature

export interface Empty extends Annotations {
  $id: "/schemas/{}"
  anyOf: [{ type: "object" }, { type: "array" }]
}

Added in v0.71.0

Enum (interface)

Signature

export interface Enum extends Annotations {
  enum: globalThis.Array<AST.LiteralValue>
}

Added in v1.0.0

Enums (interface)

Signature

export interface Enums extends Annotations {
  $comment: "/schemas/enums"
  anyOf: globalThis.Array<{
    title: string
    enum: [string | number]
  }>
}

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 =
  | Any
  | Unknown
  | Void
  | AnyObject
  | Empty
  | Ref
  | String
  | Number
  | Integer
  | Boolean
  | Array
  | Enum
  | Enums
  | AnyOf
  | Object

Added in v0.71.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
}

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
}

Added in v1.0.0

Ref (interface)

Signature

export interface Ref extends Annotations {
  $ref: string
}

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
  contentEncoding?: string
  contentMediaType?: string
  contentSchema?: JsonSchema
}

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