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

OpenApi overview

Pipeable API.

Added in v1.0.0


Table of contents


utils

allowEmptyValue

Allow an empty value for the parameter.

Setter of: parameter

Signature

export declare const allowEmptyValue: I.Setter<OpenAPISpecParameter>

Added in v1.0.0

componentSchema

Adds component schema

Signature

export declare const componentSchema: (name: string, ast: AST.AST) => I.Setter<OpenAPISpec<OpenAPISchemaType>>

Added in v1.0.0

deprecated

Allow an empty value for the parameter.

Setter of: parameter

Signature

export declare const deprecated: I.Setter<{ deprecated?: boolean | undefined }>

Added in v1.0.0

description

Set description.

Signature

export declare const description: (description: string) => I.Setter<{ description?: string | undefined }>

Added in v1.0.0

enum

Add possible values for a server variable.

Setter of: variable

Signature

export declare const enum: (...values: string[]) => I.Setter<OpenAPISpecServerVariable>

Added in v1.0.0

externalDocs

Adds external documentation object.

Setter of: openAPI, tag, operation

Signature

export declare const externalDocs: (
  externalDocs: OpenAPISpecExternalDocs
) => I.Setter<{ externalDocs?: OpenAPISpecExternalDocs | undefined }>

Added in v1.0.0

globalTags

Adds global tags.

Setter of: openAPI

Signature

export declare const globalTags: (tag: OpenAPISpecTag, ...tags: Array<OpenAPISpecTag>) => I.Setter<OpenAPISpec>

Added in v1.0.0

info

Set info section.

Available setters: description, license

Signature

export declare const info: (...setters: Array<I.Setter<OpenAPISpecInfo>>) => I.Setter<OpenAPISpec<OpenAPISchemaType>>

Added in v1.0.0

jsonRequest

Set JSON request.

Avaialble setter: description, required Setter of: operation

Signature

export declare const jsonRequest: (
  content: AnySchema,
  ...setters: Array<I.Setter<OpenAPISpecRequestBody<OpenAPISchemaType>>>
) => I.Setter<OpenAPISpecOperation<OpenAPISchemaType>>

Added in v1.0.0

jsonResponse

Set JSON response for a HTTP status code.

Available setter: description Setter of: operation

Signature

export declare const jsonResponse: (
  statusCode: OpenAPISpecStatusCode,
  contentSchema: AnySchema | undefined,
  description: string,
  ...setters: Array<I.Setter<OpenApiSpecResponse<OpenAPISchemaType>>>
) => I.Setter<OpenAPISpecOperation<OpenAPISchemaType>>

Added in v1.0.0

license

Set license in the info section.

Setter of: license

Signature

export declare const license: (name: string, url?: string) => I.Setter<OpenAPISpec<OpenAPISchemaType>>

Added in v1.0.0

noContentResponse

Add response with an empty body.

Available setter: description Setter of: operation

Signature

export declare const noContentResponse: (
  description: string,
  status: number,
  ...setters: Array<I.Setter<OpenApiSpecResponse<OpenAPISchemaType>>>
) => I.Setter<OpenAPISpecOperation<OpenAPISchemaType>>

Added in v1.0.0

openAPI

Initialize OpenAPI schema.

Available setters: info

Signature

export declare const openAPI: (
  title: string,
  version: string,
  ...setters: Array<I.Setter<OpenAPISpec<OpenAPISchemaType>>>
) => OpenAPISpec<OpenAPISchemaType>

Added in v1.0.0

operation

Set operation. Method name can be one of get, put, post, delete, options, head, patch, trace.

Available setters: parameter, jsonResponse, jsonRequest Setter of: path

Signature

export declare const operation: (
  methodName: OpenAPISpecMethodName,
  ...setters: Array<I.Setter<OpenAPISpecOperation<OpenAPISchemaType>>>
) => I.Setter<OpenAPISpecPathItem<OpenAPISchemaType>>

Added in v1.0.0

operationId

Set operationId.

Signature

export declare const operationId: (operationId: string) => I.Setter<OpenAPISpecOperation<OpenAPISchemaType>>

Added in v1.0.0

parameter

Operation parameter. One of query, header, path, cookie.

Available setters: parameter, jsonResponse, jsonRequest Setter of: path

Signature

export declare const parameter: (
  name: string,
  inValue: OpenAPISpecParameter["in"],
  schema: AnySchema,
  ...setters: Array<I.Setter<OpenAPISpecParameter<OpenAPISchemaType>>>
) => I.Setter<{ parameters?: Array<OpenAPISpecParameter<OpenAPISchemaType>> }>

Added in v1.0.0

path

Add a path to the specification.

Available setters: operation Setter of: openAPI

Signature

export declare const path: (
  path: string,
  ...setters: Array<I.Setter<OpenAPISpecPathItem<OpenAPISchemaType>>>
) => I.Setter<OpenAPISpec<OpenAPISchemaType>>

Added in v1.0.0

reference

Adds reference

Signature

export declare const reference: (referenceName: string) => OpenAPISpecReference

Added in v1.0.0

required

Make the parameter required.

Setter of: parameter, jsonRequest

Signature

export declare const required: I.Setter<OpenAPISpecParameter>

Added in v1.0.0

responseHeaders

Set response headers.

Signature

export declare const responseHeaders: (
  headers: Record<string, Schema.Schema<any, string, any>>
) => I.Setter<OpenApiSpecResponse<OpenAPISchemaType>>

Added in v1.0.0

securityRequirement

Add a security requirement to the specification.

Setter of: openAPI, operation

Signature

export declare const securityRequirement: (
  securityScheme: string,
  scopes?: Array<string>
) => I.Setter<{ security?: Array<OpenAPISecurityRequirement> }>

Added in v1.0.0

securityScheme

Add a security scheme to the specification.

Setter of: openAPI

Signature

export declare const securityScheme: (
  name: string,
  securityScheme: OpenAPISecurityScheme
) => I.Setter<OpenAPISpec<OpenAPISchemaType>>

Added in v1.0.0

server

Set the server section.

Setter of: openAPI Available setters: description, variable

Signature

export declare const server: (
  url: string,
  ...setters: Array<I.Setter<OpenAPISpecServer>>
) => I.Setter<OpenAPISpec<OpenAPISchemaType>>

Added in v1.0.0

summary

Set description.

Signature

export declare const summary: (summary: string) => I.Setter<{ summary?: string | undefined }>

Added in v1.0.0

tags

Adds operation tags.

Setter of: operation

Signature

export declare const tags: (tag: string, ...tags: Array<string>) => I.Setter<OpenAPISpecOperation<OpenAPISchemaType>>

Added in v1.0.0

variable

Add variable to a server section.

Setter of: server Available setters: description, enum

Signature

export declare const variable: (
  name: string,
  defaultValue: string,
  ...setters: Array<I.Setter<OpenAPISpecServerVariable>>
) => I.Setter<OpenAPISpecServer>

Added in v1.0.0