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

OpenApi overview

Added in v1.0.0


Table of contents


annotations

Annotatable (interface)

Signature

export interface Annotatable {
  readonly annotations: Context.Context<never>
}

Added in v1.0.0

Description (class)

Signature

export declare class Description

Added in v1.0.0

ExternalDocs (class)

Signature

export declare class ExternalDocs

Added in v1.0.0

Identifier (class)

Signature

export declare class Identifier

Added in v1.0.0

License (class)

Signature

export declare class License

Added in v1.0.0

Security (class)

Signature

export declare class Security

Added in v1.0.0

Title (class)

Signature

export declare class Title

Added in v1.0.0

Version (class)

Signature

export declare class Version

Added in v1.0.0

annotate

Signature

export declare const annotate: {
  (annotations: {
    readonly identifier?: string | undefined
    readonly title?: string | undefined
    readonly description?: string | undefined
    readonly version?: string | undefined
    readonly license?: OpenAPISpecLicense | undefined
    readonly security?: HttpApiSecurity | undefined
    readonly externalDocs?: OpenAPISpecExternalDocs | undefined
  }): <A extends Annotatable>(self: A) => A
  <A extends Annotatable>(
    self: A,
    annotations: {
      readonly identifier?: string | undefined
      readonly title?: string | undefined
      readonly description?: string | undefined
      readonly version?: string | undefined
      readonly license?: OpenAPISpecLicense | undefined
      readonly security?: HttpApiSecurity | undefined
      readonly externalDocs?: OpenAPISpecExternalDocs | undefined
    }
  ): A
}

Added in v1.0.0

annotations

Signature

export declare const annotations: (annotations: {
  readonly identifier?: string | undefined
  readonly title?: string | undefined
  readonly description?: string | undefined
  readonly version?: string | undefined
  readonly license?: OpenAPISpecLicense | undefined
  readonly security?: HttpApiSecurity | undefined
  readonly externalDocs?: OpenAPISpecExternalDocs | undefined
}) => Context.Context<never>

Added in v1.0.0

constructors

fromApi

Signature

export declare const fromApi: <A extends HttpApi.HttpApi.Any>(api: A) => OpenAPISpec

Added in v1.0.0

models

OpenAPIApiKeySecurityScheme (interface)

Signature

export interface OpenAPIApiKeySecurityScheme {
  readonly type: "apiKey"
  readonly description?: string
  readonly name: string
  readonly in: "query" | "header" | "cookie"
}

Added in v1.0.0

OpenAPIComponents (interface)

Signature

export interface OpenAPIComponents {
  readonly schemas?: ReadonlyRecord<string, JsonSchema.JsonSchema>
  readonly securitySchemes?: ReadonlyRecord<string, OpenAPISecurityScheme>
}

Added in v1.0.0

OpenAPIHTTPSecurityScheme (interface)

Signature

export interface OpenAPIHTTPSecurityScheme {
  readonly type: "http"
  readonly description?: string
  readonly scheme: "bearer" | "basic" | string
  /* only for scheme: 'bearer' */
  readonly bearerFormat?: string
}

Added in v1.0.0

OpenAPIMutualTLSSecurityScheme (interface)

Signature

export interface OpenAPIMutualTLSSecurityScheme {
  readonly type: "mutualTLS"
  readonly description?: string
}

Added in v1.0.0

OpenAPIOAuth2SecurityScheme (interface)

Signature

export interface OpenAPIOAuth2SecurityScheme {
  readonly type: "oauth2"
  readonly description?: string
  readonly flows: ReadonlyRecord<
    "implicit" | "password" | "clientCredentials" | "authorizationCode",
    ReadonlyRecord<string, unknown>
  >
}

Added in v1.0.0

OpenAPIOpenIdConnectSecurityScheme (interface)

Signature

export interface OpenAPIOpenIdConnectSecurityScheme {
  readonly type: "openIdConnect"
  readonly description?: string
  readonly openIdConnectUrl: string
}

Added in v1.0.0

OpenAPISecurityRequirement (type alias)

Signature

export type OpenAPISecurityRequirement = ReadonlyRecord<string, Array<string>>

Added in v1.0.0

OpenAPISecurityScheme (type alias)

Signature

export type OpenAPISecurityScheme =
  | OpenAPIHTTPSecurityScheme
  | OpenAPIApiKeySecurityScheme
  | OpenAPIMutualTLSSecurityScheme
  | OpenAPIOAuth2SecurityScheme
  | OpenAPIOpenIdConnectSecurityScheme

Added in v1.0.0

OpenAPISpec (interface)

Signature

export interface OpenAPISpec {
  readonly openapi: "3.0.3"
  readonly info: OpenAPISpecInfo
  readonly servers?: Array<OpenAPISpecServer>
  readonly paths: OpenAPISpecPaths
  readonly components?: OpenAPIComponents
  readonly security?: Array<OpenAPISecurityRequirement>
  readonly tags?: Array<OpenAPISpecTag>
  readonly externalDocs?: OpenAPISpecExternalDocs
}

Added in v1.0.0

OpenAPISpecExternalDocs (interface)

Signature

export interface OpenAPISpecExternalDocs {
  readonly url: string
  readonly description?: string
}

Added in v1.0.0

OpenAPISpecInfo (interface)

Signature

export interface OpenAPISpecInfo {
  readonly title: string
  readonly version: string
  readonly description?: string
  readonly license?: OpenAPISpecLicense
}

Added in v1.0.0

OpenAPISpecLicense (interface)

Signature

export interface OpenAPISpecLicense {
  readonly name: string
  readonly url?: string
}

Added in v1.0.0

OpenAPISpecMethodName (type alias)

Signature

export type OpenAPISpecMethodName = "get" | "put" | "post" | "delete" | "options" | "head" | "patch" | "trace"

Added in v1.0.0

OpenAPISpecOperation (interface)

Signature

export interface OpenAPISpecOperation {
  readonly requestBody?: OpenAPISpecRequestBody
  readonly responses?: OpenAPISpecResponses
  readonly operationId?: string
  readonly description?: string
  readonly parameters?: Array<OpenAPISpecParameter>
  readonly summary?: string
  readonly deprecated?: boolean
  readonly tags?: Array<string>
  readonly security?: Array<OpenAPISecurityRequirement>
  readonly externalDocs?: OpenAPISpecExternalDocs
}

Added in v1.0.0

OpenAPISpecParameter (interface)

Signature

export interface OpenAPISpecParameter {
  readonly name: string
  readonly in: "query" | "header" | "path" | "cookie"
  readonly schema: JsonSchema.JsonSchema
  readonly description?: string
  readonly required?: boolean
  readonly deprecated?: boolean
  readonly allowEmptyValue?: boolean
}

Added in v1.0.0

OpenAPISpecPathItem (type alias)

Signature

export type OpenAPISpecPathItem = {
  readonly [K in OpenAPISpecMethodName]?: OpenAPISpecOperation
} & {
  readonly summary?: string
  readonly description?: string
  readonly parameters?: Array<OpenAPISpecParameter>
}

Added in v1.0.0

OpenAPISpecPaths (type alias)

Signature

export type OpenAPISpecPaths = ReadonlyRecord<string, OpenAPISpecPathItem>

Added in v1.0.0

OpenAPISpecRequestBody (interface)

Signature

export interface OpenAPISpecRequestBody {
  readonly content: OpenApiSpecContent
  readonly description?: string
  readonly required?: boolean
}

Added in v1.0.0

OpenAPISpecResponses (type alias)

Signature

export type OpenAPISpecResponses = Record<number, OpenApiSpecResponse>

Added in v1.0.0

OpenAPISpecServer (interface)

Signature

export interface OpenAPISpecServer {
  readonly url: string
  readonly description?: string
  readonly variables?: Record<string, OpenAPISpecServerVariable>
}

Added in v1.0.0

OpenAPISpecServerVariable (interface)

Signature

export interface OpenAPISpecServerVariable {
  readonly default: string
  readonly enum?: [string, ...Array<string>]
  readonly description?: string
}

Added in v1.0.0

OpenAPISpecTag (interface)

Signature

export interface OpenAPISpecTag {
  readonly name: string
  readonly description?: string
  readonly externalDocs?: OpenAPISpecExternalDocs
}

Added in v1.0.0

OpenApiSpecContent (type alias)

Signature

export type OpenApiSpecContent = {
  readonly [K in OpenApiSpecContentType]?: OpenApiSpecMediaType
}

Added in v1.0.0

OpenApiSpecContentType (type alias)

Signature

export type OpenApiSpecContentType = "application/json" | "application/xml" | "multipart/form-data" | "text/plain"

Added in v1.0.0

OpenApiSpecMediaType (interface)

Signature

export interface OpenApiSpecMediaType {
  readonly schema?: JsonSchema.JsonSchema
  readonly example?: object
  readonly description?: string
}

Added in v1.0.0

OpenApiSpecResponse (interface)

Signature

export interface OpenApiSpecResponse {
  readonly content?: OpenApiSpecContent
  readonly headers?: OpenApiSpecResponseHeaders
  readonly description: string
}

Added in v1.0.0

OpenApiSpecResponseHeader (interface)

Signature

export interface OpenApiSpecResponseHeader {
  readonly description?: string
  readonly schema: JsonSchema.JsonSchema
}

Added in v1.0.0

OpenApiSpecResponseHeaders (type alias)

Signature

export type OpenApiSpecResponseHeaders = ReadonlyRecord<string, OpenApiSpecResponseHeader>

Added in v1.0.0