UNPKG

@autorest/modelerfour

Version:
41 lines 1.77 kB
import { Operation } from "@autorest/codemodel"; import { Session } from "@autorest/extension-base"; import { KnownMediaType } from "@azure-tools/codegen"; import * as OpenAPI from "@azure-tools/openapi"; import { Dereferenced, HttpMethod } from "@azure-tools/openapi"; export interface KnownMediaTypeGroupItem { mediaType: string; schema: Dereferenced<OpenAPI.Schema | undefined>; } export interface RequestBodyGroup { schema: OpenAPI.Schema; type: KnownMediaType; mediaTypes: string[]; } /** * Body processing functions */ export declare class BodyProcessor { private session; constructor(session: Session<OpenAPI.Model>); /** * Returns a map of the all the content type + schema grouped by category(Binary, json, xml, etc.) * @param oai3Content OpenAPI 3 Content of the requestBody * @returns Map mapping known media types to list of schema/content type using it. */ groupMediaTypes(oai3Content: { [mediaType: string]: OpenAPI.MediaType; } | undefined): Map<KnownMediaType, KnownMediaTypeGroupItem[]>; groupRequestBodyBySchema(oai3Content: { [mediaType: string]: OpenAPI.MediaType; } | undefined, operationName: string): RequestBodyGroup[]; /** * Cleanup body types that are invalid for the content type. * This can happen when converting swagger 2.0 which only let one type of body but can accept different content types. */ private cleanupInvalidBodies; private getKnownMediaType; validateBodyContentTypes(httpMethod: HttpMethod, httpOperation: OpenAPI.HttpOperation, operationName: string): void; addNoBodyRequest(operation: Operation, httpMethod: HttpMethod, path: string, baseUri: string): void; } //# sourceMappingURL=body-processor.d.ts.map