microsoft/typespec
Publicmirrored from https://github.com/microsoft/typespecAvailable
packages/openapi3/src/types.ts
43lines · modecode
| 1 | export type ExtensionKey = `x-${string}`; |
| 2 | |
| 3 | export type Extensions = { |
| 4 | [key in ExtensionKey]?: any; |
| 5 | }; |
| 6 | |
| 7 | export interface OpenAPI3Discriminator extends Extensions { |
| 8 | propertyName: string; |
| 9 | mapping?: Record<string, string>; |
| 10 | } |
| 11 | |
| 12 | export type JsonType = "array" | "boolean" | "integer" | "number" | "object" | "string"; |
| 13 | |
| 14 | export type OpenAPI3Schema = Extensions & { |
| 15 | type: JsonType; |
| 16 | description?: string; |
| 17 | properties?: Record<string, any>; |
| 18 | required?: string[]; |
| 19 | discriminator?: OpenAPI3Discriminator; |
| 20 | |
| 21 | allOf?: any[]; |
| 22 | anyOf?: any[]; |
| 23 | oneOf?: any[]; |
| 24 | }; |
| 25 | |
| 26 | export type OpenAPI3ParameterType = "header" | "query" | "path"; |
| 27 | export type OpenAPI3Parameter = Extensions & { |
| 28 | in: OpenAPI3ParameterType; |
| 29 | schema: OpenAPI3Schema; |
| 30 | name: string; |
| 31 | required?: boolean; |
| 32 | description?: string; |
| 33 | }; |
| 34 | |
| 35 | export type OpenAPI3Operation = Extensions & { |
| 36 | description?: string; |
| 37 | summary?: string; |
| 38 | responses?: any; |
| 39 | tags?: string[]; |
| 40 | operationId?: string; |
| 41 | requestBody?: any; |
| 42 | parameters: OpenAPI3Parameter[]; |
| 43 | }; |
| 44 | |