UNPKG

fluid-oas

Version:

Build declarative OpenApiv3.* specifications.

55 lines (54 loc) 2.69 kB
import type { OpenApiSchema } from "../schema"; import { type BaseInterface } from "./base"; import type { OpenApiCallback } from "./OpenApiCallback"; import type { OpenApiExample } from "./OpenApiExample"; import type { OpenApiHeader } from "./OpenApiHeader"; import type { OpenApiLink } from "./OpenApiLink"; import type { OpenApiParameter } from "./OpenApiParameter"; import type { OpenApiPathItem } from "./OpenApiPathItem"; import { type OpenApiReferenceObject } from "./OpenApiReferenceObject"; import type { OpenApiRequestBody } from "./OpenApiRequestBody"; import type { OpenApiResponses } from "./OpenApiResponses"; import type { OpenApiSecurityScheme } from "./OpenApiSecurityScheme"; export type ComponentMappings = OpenApiSchema | OpenApiResponses | OpenApiParameter | OpenApiExample | OpenApiRequestBody | OpenApiHeader | OpenApiSecurityScheme | OpenApiLink | OpenApiCallback | OpenApiPathItem | OpenApiReferenceObject; export interface OpenApiComponent extends BaseInterface { addSchemas(mappings: Partial<{ [K in string]: OpenApiSchema | OpenApiReferenceObject; }>): this; addResponses(mappings: Partial<{ [K in string]: OpenApiResponses | OpenApiReferenceObject; }>): this; addParameters(mappings: Partial<{ [K in string]: OpenApiParameter | OpenApiReferenceObject; }>): this; addExamples(mappings: Partial<{ [K in string]: OpenApiExample | OpenApiReferenceObject; }>): this; addRequestBodies(mappings: Partial<{ [K in string]: OpenApiRequestBody | OpenApiReferenceObject; }>): this; addHeaders(mappings: Partial<{ [K in string]: OpenApiHeader | OpenApiReferenceObject; }>): this; addSecuritySchemes(mappings: Partial<{ [K in string]: OpenApiSecurityScheme | OpenApiReferenceObject; }>): this; addLinks(mappings: Partial<{ [K in string]: OpenApiLink | OpenApiReferenceObject; }>): this; addCallbacks(mappings: Partial<{ [K in string]: OpenApiCallback | OpenApiReferenceObject; }>): this; addPathItems(mappings: Partial<{ [K in string]: OpenApiPathItem | OpenApiReferenceObject; }>): this; /** * A convenient helper method that allows the creating of a dedicating mapping for all * potential reusable reference objects defined with the Component object. Developers may use this * method to obtain the reference object from a specific schema, pathItem, etc. * * @returns a FROZEN Mapping for each possible content mapping and its associated reference object. */ createMappings(): Map<ComponentMappings, OpenApiReferenceObject>; } export declare const Component: OpenApiComponent;