@typespec/openapi3
Version:
TypeSpec library for emitting OpenAPI 3.0 and OpenAPI 3.1 from the TypeSpec REST protocol binding and converting OpenAPI3 to TypeSpec
20 lines • 1.33 kB
TypeScript
import { Example, Program, Type, Value } from "@typespec/compiler";
import { type HttpOperation, type HttpProperty } from "@typespec/http";
import { ExperimentalParameterExamplesStrategy } from "./lib.js";
import { OpenAPI3MediaType } from "./types.js";
import { SharedHttpOperation } from "./util.js";
export interface OperationExamples {
requestBody: Record<string, [Example, Type][]>;
parameters: Record<string, [Example, Type][]>;
responses: Record<string, Record<string, [Example, Type][]>>;
}
type ResolveOperationExamplesOptions = {
parameterExamplesStrategy?: ExperimentalParameterExamplesStrategy;
};
export declare function resolveOperationExamples(program: Program, operation: HttpOperation | SharedHttpOperation, { parameterExamplesStrategy }: ResolveOperationExamplesOptions): OperationExamples;
export declare function getExampleOrExamples(program: Program, examples: [Example, Type][]): Pick<OpenAPI3MediaType, "example" | "examples">;
export declare function getStatusCodeValue(value: Value, properties: HttpProperty[]): number | undefined;
export declare function getContentTypeValue(value: Value, properties: HttpProperty[]): string | undefined;
export declare function getBodyValue(value: Value, properties: HttpProperty[]): Value | undefined;
export {};
//# sourceMappingURL=examples.d.ts.map