import { IJsonSchemaAttribute } from "./structures/IJsonSchemaAttribute"; /** * Swagger v2.0 definition. * * @author Jeongho Nam - https://github.com/samchon */ export declare namespace SwaggerV2 { type Method = "get" | "post" | "put" | "delete" | "options" | "head" | "patch" | "trace"; interface IDocument { swagger: "2.0" | `2.0.${number}`; info?: IDocument.IInfo; host?: string; basePath?: string; consumes?: string[]; produces?: string[]; definitions?: Record; parameters?: Record; responses?: Record; securityDefinitions?: Record; security?: Record[]; paths?: Record; tags?: IDocument.ITag[]; } namespace IDocument { interface IInfo { title: string; description?: string; termsOfService?: string; contact?: IContact; license?: ILicense; version: string; } interface IContact { name?: string; url?: string; email?: string; } interface ILicense { name: string; url?: string; } interface ITag { name: string; description?: string; } } interface IPath extends Partial> { parameters?: Array>; } interface IOperation { operationId?: string; parameters?: Array>; responses?: Record>; summary?: string; description?: string; security?: Record[]; tags?: string[]; deprecated?: boolean; } namespace IOperation { type IParameter = IGeneralParameter | IBodyParameter; type IGeneralParameter = IJsonSchema & { name: string; in: string; description?: string; }; interface IBodyParameter { schema: IJsonSchema; name: string; in: string; description?: string; required?: boolean; } interface IResponse { description?: string; headers?: Record; schema?: IJsonSchema; example?: any; } } type IJsonSchema = IJsonSchema.IBoolean | IJsonSchema.IInteger | IJsonSchema.INumber | IJsonSchema.IString | IJsonSchema.IArray | IJsonSchema.IObject | IJsonSchema.IReference | IJsonSchema.IAnyOf | IJsonSchema.IOneOf | IJsonSchema.INullOnly | IJsonSchema.IUnknown; namespace IJsonSchema { interface IBoolean extends Omit, __ISignificant<"boolean"> { default?: boolean | null; enum?: Array; } interface IInteger extends Omit, __ISignificant<"integer"> { /** @type int64 */ default?: number | null; /** @type int64 */ enum?: Array; /** @type int64 */ minimum?: number; /** @type int64 */ maximum?: number; exclusiveMinimum?: number | boolean; exclusiveMaximum?: number | boolean; /** * @type uint64 * @exclusiveMinimum 0 */ multipleOf?: number; } interface INumber extends Omit, __ISignificant<"number"> { default?: number | null; enum?: Array; minimum?: number; maximum?: number; exclusiveMinimum?: number | boolean; exclusiveMaximum?: number | boolean; /** @exclusiveMinimum 0 */ multipleOf?: number; } interface IString extends Omit, __ISignificant<"string"> { default?: string | null; enum?: Array; format?: "binary" | "byte" | "password" | "regex" | "uuid" | "email" | "hostname" | "idn-email" | "idn-hostname" | "iri" | "iri-reference" | "ipv4" | "ipv6" | "uri" | "uri-reference" | "uri-template" | "url" | "date-time" | "date" | "time" | "duration" | "json-pointer" | "relative-json-pointer" | (string & {}); pattern?: string; /** @type uint64 */ minLength?: number; /** @type uint64 */ maxLength?: number; } interface IArray extends Omit, __ISignificant<"array"> { items: IJsonSchema; uniqueItems?: boolean; /** @type uint64 */ minItems?: number; /** @type uint64 */ maxItems?: number; } interface IObject extends Omit, __ISignificant<"object"> { properties?: Record; required?: string[]; additionalProperties?: boolean | IJsonSchema; maxProperties?: number; minProperties?: number; } interface IReference extends __IAttribute { $ref: Key; } interface IAllOf extends __IAttribute { allOf: IJsonSchema[]; } interface IAnyOf extends __IAttribute { "x-anyOf": IJsonSchema[]; } interface IOneOf extends __IAttribute { "x-oneOf": IJsonSchema[]; } interface INullOnly extends __IAttribute { type: "null"; default?: null; } interface IUnknown extends __IAttribute { type?: undefined; } interface __ISignificant extends __IAttribute { type: Type; "x-nullable"?: boolean; } interface __IAttribute extends Omit { examples?: any[]; } } type ISecurityDefinition = ISecurityDefinition.IApiKey | ISecurityDefinition.IBasic | ISecurityDefinition.IOauth2Implicit | ISecurityDefinition.IOauth2AccessCode | ISecurityDefinition.IOauth2Password | ISecurityDefinition.IOauth2Application; namespace ISecurityDefinition { interface IApiKey { type: "apiKey"; in?: "header" | "query" | "cookie"; name?: string; description?: string; } interface IBasic { type: "basic"; name?: string; description?: string; } interface IOauth2Implicit { type: "oauth2"; flow: "implicit"; authorizationUrl?: string; scopes?: Record; description?: string; } interface IOauth2AccessCode { type: "oauth2"; flow: "accessCode"; authorizationUrl?: string; tokenUrl?: string; scopes?: Record; description?: string; } interface IOauth2Password { type: "oauth2"; flow: "password"; tokenUrl?: string; scopes?: Record; description?: string; } interface IOauth2Application { type: "oauth2"; flow: "application"; tokenUrl?: string; scopes?: Record; description?: string; } } }