OpenAPI document
OasLink
Represents a Link Object in the OpenAPI Specification.
A link describes a possible design-time relationship from a response to another operation - for example, how the id in a create response can be used as the path parameter of a subsequent fetch. It names the target operation (by operationId or operationRef) and how to populate its parameters and request body from the current response.
Signature
import { OasLink } from '@skmtc/core'
class OasLinkExamples
import { OasLink } from '@skmtc/core';
const getUserByUserId = new OasLink({
operationId: 'getUser',
parameters: { userId: '$response.body#/id' },
description: 'The `id` of the created user is the `userId` of GET /users/{userId}'
});Constructor
constructor
constructor(fields: LinkFields)Properties
A URI reference to a target operation
The operationId of a target operation
Parameter values or runtime expressions for the target operation
The request body value or runtime expression for the target operation
A description of the link
A server to use for the target operation
Specification Extension fields
Methods
isRef
isRef(): this is OasRef<'link'>Returns true if object is a reference
isReadOnly
isReadOnly(): booleanAlways false: readOnly is a schema keyword.
isWriteOnly
isWriteOnly(): booleanAlways false: writeOnly is a schema keyword.
resolve
resolve(): OasLinkReturns itself
resolveOnce
resolveOnce(): OasLinktoJsonSchema
toJsonSchema(options: ToJsonSchemaOptions): OpenAPIV3.LinkObject