Class: builderbase = new BuilderBase()

constructor(initialSpec: T) : BuilderBase

Arguments
Name Type Description
initialSpec T

build() : T

Build the spec object.

withExtension(key: string, value: ExtensionValue) : this

Add a custom (extension) property to the spec object.

Arguments
Name Type Description
key string

The property name starting with "x-".

value ExtensionValue

The property value.

Class: openapispecbuilder = new OpenApiSpecBuilder()

A builder for creating OpenApiSpec documents.

constructor() : OpenApiSpecBuilder

withOperation(verb: string, path: string, spec: undefined) : this

Define a new OperationObject at the given path and verb (method).

Arguments
Name Type Description
verb string

The HTTP verb.

path string

The path relative to basePath.

spec

Additional specification of the operation.

withOperationReturningString(verb: string, path: string, operationName: string) : this

Define a new operation that returns a string response.

Arguments
Name Type Description
verb string

The HTTP verb.

path string

The path relative to basePath.

operationName string

The name of the controller method implementing this operation (x-operation-name field).

Class: operationspecbuilder = new OperationSpecBuilder()

A builder for creating OperationObject specifications.

constructor() : OperationSpecBuilder

A builder for creating OperationObject specifications.

withOperationName(name: string) : this

Define the operation name (controller method name).

Arguments
Name Type Description
name string

The name of the controller method implementing this operation.

withParameter(parameterSpec: ParameterObject) : this

Describe a parameter accepted by the operation. Note that parameters are positional in OpenAPI Spec, therefore the first call of withParameter defines the first parameter, the second call defines the second parameter, etc.

Arguments
Name Type Description
parameterSpec ParameterObject

withResponse(status: undefined, responseSpec: ResponseObject) : this

Describe a response for a given HTTP status code.

Arguments
Name Type Description
status

HTTP status code or string "default"

responseSpec ResponseObject

Specification of the response

withStringResponse(status: undefined) : this

Arguments
Name Type Description
status

A builder for creating OperationObject specifications.

Interface: Extendable

anOpenApiSpec() : OpenApiSpecBuilder

Create a new instance of OpenApiSpecBuilder.

anOperationSpec() : OperationSpecBuilder

Create a new instance of OperationSpecBuilder.