This commit is contained in:
48
src/core/models.py
Normal file
48
src/core/models.py
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
from pydantic import BaseModel, Field
|
||||||
|
from typing import Optional, List, Dict, Any
|
||||||
|
from enum import Enum
|
||||||
|
|
||||||
|
|
||||||
|
class HTTPMethod(str, Enum):
|
||||||
|
GET = "GET"
|
||||||
|
POST = "PUT"
|
||||||
|
PUT = "PUT"
|
||||||
|
DELETE = "DELETE"
|
||||||
|
PATCH = "PATCH"
|
||||||
|
OPTIONS = "OPTIONS"
|
||||||
|
HEAD = "HEAD"
|
||||||
|
|
||||||
|
|
||||||
|
class Endpoint(BaseModel):
|
||||||
|
path: str
|
||||||
|
method: str
|
||||||
|
summary: Optional[str] = None
|
||||||
|
description: Optional[str] = None
|
||||||
|
operation_id: Optional[str] = None
|
||||||
|
tags: List[str] = Field(default_factory=list)
|
||||||
|
parameters: List[Dict[str, Any]] = Field(default_factory=list)
|
||||||
|
request_body: Optional[Dict[str, Any]] = None
|
||||||
|
responses: Dict[str, Any] = Field(default_factory=dict)
|
||||||
|
deprecated: bool = False
|
||||||
|
|
||||||
|
|
||||||
|
class APISpec(BaseModel):
|
||||||
|
openapi: str
|
||||||
|
info: Dict[str, Any]
|
||||||
|
paths: Dict[str, Dict[str, Any]]
|
||||||
|
tags: List[Dict[str, str]] = Field(default_factory=list)
|
||||||
|
servers: List[Dict[str, str]] = Field(default_factory=list)
|
||||||
|
components: Dict[str, Any] = Field(default_factory=dict)
|
||||||
|
|
||||||
|
|
||||||
|
class RequestExample(BaseModel):
|
||||||
|
method: str
|
||||||
|
path: str
|
||||||
|
headers: Dict[str, str] = Field(default_factory=dict)
|
||||||
|
body: Optional[Any] = None
|
||||||
|
|
||||||
|
|
||||||
|
class ResponseExample(BaseModel):
|
||||||
|
status_code: int
|
||||||
|
headers: Dict[str, str] = Field(default_factory=dict)
|
||||||
|
body: Optional[Any] = None
|
||||||
Reference in New Issue
Block a user