Skip to content

@saflib/openapi


index ​

Interfaces ​

InterfaceDescription
components-

Type Aliases ​

Type AliasDescription
Address-
AssertNoRootResponseBodiesOptions-
ExtractRequestBodyConvenience type to lookup the request body by operationId.
ExtractRequestPathParamsConvenience type to lookup the path params by operationId.
ExtractRequestQueryParamsConvenience type to lookup the query params by operationId.
ExtractResponseBodyConvenience type to lookup the response body by operationId.
OpenApiDocumentBundled OpenAPI document accepted by express-openapi-validator (3.0.x or 3.1.x).
OpenApiEnforcedTag-
OpenApiEnforcedTagMeta-
OpenApiTagViolation-
RootResponseAllowKeyoperationId:statusCode, e.g. getMatter:200.
RootResponseBodyViolation-

Variables ​

VariableDescription
OPENAPI_ENFORCED_TAG_CATALOG-
OPENAPI_ENFORCED_TAG_SET-
OPENAPI_ENFORCED_TAGS-
OPENAPI_TAG_BACKGROUNDMarks an operation as invocable by the job queue.
OPENAPI_TAG_CSRF_EXEMPT-
OPENAPI_TAG_EMAIL_VERIFIED-
OPENAPI_TAG_MFA_REQUIRED-
OPENAPI_TAG_NO_AUTH-
OPENAPI_TAG_SITE_ADMIN_ONLY-

Functions ​

FunctionDescription
asOpenApiDocumentCast an inline OpenAPI object (e.g. in tests) to OpenApiDocument.
assertNoRootResponseBodiesThrow if any success JSON response puts a resource at the document root. Pass current offenders in allow and remove entries as routes are migrated.
assertOpenApiOperationTagsThrow if any operation uses a tag outside OPENAPI_ENFORCED_TAGS. Call at startup when loading a product OpenAPI document (and from package tests).
assertOpenApiRouteFileTags-
castJsonOpenAPI JSON from import * as json from "./openapi.json" with { type: "json" }.
findRootResponseBodyViolationsFind 2xx application/json response schemas that put a business object, array, or bare $ref at the document root instead of a flat keyed envelope ({ recipe: Recipe }, { recipes: Recipe[] }).
findUnknownOpenApiOperationTagsCollect unknown operation tags from a bundled (or single-operation) OpenAPI document.
findUnknownOpenApiRouteFileTagsScan routes YAML under a spec package for unknown operation tags. Prefer this in package tests; use assertOpenApiOperationTags on the bundled document at process startup.