Module: core/base-service/openapi

Functions for publishing the shields.io URL schema as an OpenAPI Document

Source:

Methods

(inner) pathParam(param) → {module:core/base-service/openapi~OpenApiParam}

Helper function for assembling an OpenAPI path parameter object

Parameters:
Name Type Description
param module:core/base-service/openapi~PathParamInput

Input param

Source:
See:
Returns:

OpenAPI Parameter Object

Type
module:core/base-service/openapi~OpenApiParam

(inner) pathParams(…params) → {Array.<module:core/base-service/openapi~OpenApiParam>}

Helper function for assembling an array of OpenAPI path parameter objects The code

const params = pathParams(
  { name: 'name1', example: 'example1' },
  { name: 'name2', example: 'example2' },
)

is equivalent to

const params = [
  pathParam({ name: 'name1', example: 'example1' }),
  pathParam({ name: 'name2', example: 'example2' }),
]
Parameters:
Name Type Attributes Description
params module:core/base-service/openapi~PathParamInput <repeatable>

Input params

Source:
See:
Returns:

Array of OpenAPI Parameter Objects

Type
Array.<module:core/base-service/openapi~OpenApiParam>

(inner) queryParam(param) → {module:core/base-service/openapi~OpenApiParam}

Helper function for assembling an OpenAPI query parameter object

Parameters:
Name Type Description
param module:core/base-service/openapi~QueryParamInput

Input param

Source:
See:
Returns:

OpenAPI Parameter Object

Type
module:core/base-service/openapi~OpenApiParam

(inner) queryParams(…params) → {Array.<module:core/base-service/openapi~OpenApiParam>}

Helper function for assembling an array of OpenAPI query parameter objects The code

const params = queryParams(
  { name: 'name1', example: 'example1' },
  { name: 'name2', example: 'example2' },
)

is equivalent to

const params = [
  queryParam({ name: 'name1', example: 'example1' }),
  queryParam({ name: 'name2', example: 'example2' }),
]
Parameters:
Name Type Attributes Description
params module:core/base-service/openapi~QueryParamInput <repeatable>

Input params

Source:
See:
Returns:

Array of OpenAPI Parameter Objects

Type
Array.<module:core/base-service/openapi~OpenApiParam>

Type Definitions

OpenApiParam

OpenAPI Parameter Object

Type:
  • object
Properties:
Name Type Description
name string

The name of the parameter

example string | null

Example of a valid value for this parameter

in 'path' | 'query'

The location of the parameter

schema object

Parameter schema. An OpenAPI Schema object specifying the parameter type.

required boolean

Determines whether this parameter is mandatory

description string

A brief description of the parameter

allowEmptyValue boolean

If true, allows the ability to pass an empty value to this parameter

Source:

PathParamInput

Type:
  • object
Properties:
Name Type Attributes Default Description
name string

The name of the parameter. Parameter names are case sensitive

example string

Example of a valid value for this parameter

schema object <optional>
{ type: 'string' }

Parameter schema. An OpenAPI Schema object specifying the parameter type. Normally this should be omitted as all path parameters are strings. Use this when we also want to pass an enum of valid parameters to be presented as a drop-down in the frontend. e.g: {'type': 'string', 'enum': ['github', 'bitbucket'} (Optional)

description string

A brief description of the parameter (Optional)

Source:

QueryParamInput

Type:
  • object
Properties:
Name Type Attributes Default Description
name string

The name of the parameter. Parameter names are case sensitive

example string | null

Example of a valid value for this parameter

schema object <optional>
{ type: 'string' }

Parameter schema. An OpenAPI Schema object specifying the parameter type. This can normally be omitted. Query params are usually strings. (Optional)

required boolean <optional>
false

Determines whether this parameter is mandatory (Optional)

description string

A brief description of the parameter (Optional)

Source: