uspring
Version:
A very fast Webserver which has interface like springboot
125 lines (121 loc) • 4.02 kB
TypeScript
import { IServerObject } from "./ServerObject";
import { IParameterObject, IReferenceObject, IRequestBodyObject, ICallbackObject } from "./ComponentObject";
import { IExternalDocumentationObject } from "./TagObject";
import { ISecurityRequirementObject } from "./SecurityRequirementObject";
/**
* Path Item Object
*
*
* Describes the operations available on a single path. A Path Item MAY be empty, due to ACL constraints. The path itself is still exposed to the documentation viewer but they will not know which operations and parameters are available.
*/
export interface IPathItemObject {
$ref: string;
summary: string;
description?: string;
get?: IOperationObject;
put?: IOperationObject;
post?: IOperationObject;
delete?: IOperationObject;
options?: IOperationObject;
head?: IOperationObject;
patch?: IOperationObject;
trace?: IOperationObject;
servers?: IServerObject[];
parameters?: IParameterObject[] | IReferenceObject[];
}
/**
* OperationObject
*
* https://github.com/OAI/OpenAPI-Specification/blob/OpenAPI.next/versions/3.0.0.md#operation-object
* Describes a single API operation on a path.
* example:
* {
"tags": [
"pet"
],
"summary": "Updates a pet in the store with form data",
"operationId": "updatePetWithForm",
"parameters": [
{
"name": "petId",
"in": "path",
"description": "ID of pet that needs to be updated",
"required": true,
"schema": {
"type": "string"
}
}
],
"requestBody": {
"content": {
"application/x-www-form-urlencoded": {
"schema": {
"type": "object",
"properties": {
"name": {
"description": "Updated name of the pet",
"type": "string"
},
"status": {
"description": "Updated status of the pet",
"type": "string"
}
},
"required": ["status"]
}
}
}
},
"responses": {
"200": {
"description": "Pet updated.",
"content": {
"application/json": {},
"application/xml": {}
}
},
"405": {
"description": "Invalid input",
"content": {
"application/json": {},
"application/xml": {}
}
}
},
"security": [
{
"petstore_auth": [
"write:pets",
"read:pets"
]
}
]
}
*/
export interface IOperationObject {
tags?: string[];
summary?: string;
description?: string;
externalDocs?: IExternalDocumentationObject;
operationId: string;
parameters: IParameterObject[] | IReferenceObject[];
requestBody: IRequestBodyObject | IReferenceObject;
responses: IResponseObject[];
callbacks?: Map<string, ICallbackObject | IReferenceObject>;
deprecated: boolean;
security?: ISecurityRequirementObject[];
}
/**
* Responses Object
*
* https://github.com/OAI/OpenAPI-Specification/blob/OpenAPI.next/versions/3.0.0.md#responsesObject
A container for the expected responses of an operation. The container maps a HTTP response code to the expected response.
The documentation is not necessarily expected to cover all possible HTTP response codes because they may not be known in advance. However, documentation is expected to cover a successful operation response and any known errors.
The default MAY be used as a default response object for all HTTP codes that are not covered individually by the specification.
The Responses Object MUST contain at least one response code, and it SHOULD be the response for a successful operation call.
*/
export interface IResponseObject extends Map<HTTPStatusCode, IResponseObject | IReferenceObject> {
default: IResponseObject | IReferenceObject;
}
export declare type HTTPStatusCode = 100 | 101 | 102 | 103 | 104 | 200 | 201 | 202 | 203 | 204 | 300 | 301 | 302 | 303 | 304 | 400 | 401 | 402 | 403 | 404 | 500 | 501 | 502 | 503 | 504;
//# sourceMappingURL=PathItemObject.d.ts.map