Initial upload: API Mock CLI v0.1.0
Some checks failed
CI / test (3.10) (push) Has been cancelled
CI / test (3.11) (push) Has been cancelled
CI / test (3.12) (push) Has been cancelled
CI / test (3.9) (push) Has been cancelled
CI / lint (push) Has been cancelled
CI / type-check (push) Has been cancelled
CI / build (push) Has been cancelled
Some checks failed
CI / test (3.10) (push) Has been cancelled
CI / test (3.11) (push) Has been cancelled
CI / test (3.12) (push) Has been cancelled
CI / test (3.9) (push) Has been cancelled
CI / lint (push) Has been cancelled
CI / type-check (push) Has been cancelled
CI / build (push) Has been cancelled
This commit is contained in:
26
src/models/response.py
Normal file
26
src/models/response.py
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
from typing import Dict, Any, Optional
|
||||||
|
from pydantic import BaseModel, Field
|
||||||
|
|
||||||
|
|
||||||
|
class Response(BaseModel):
|
||||||
|
status_code: int = Field(default=200, description="HTTP status code")
|
||||||
|
body: Optional[Dict[str, Any]] = Field(default=None, description="Response body template")
|
||||||
|
headers: Optional[Dict[str, str]] = Field(default=None, description="Response headers")
|
||||||
|
delay: Optional[int] = Field(default=None, description="Response delay in milliseconds")
|
||||||
|
fixed: bool = Field(default=False, description="Whether response is fixed or templated")
|
||||||
|
|
||||||
|
class Config:
|
||||||
|
json_schema_extra = {
|
||||||
|
"example": {
|
||||||
|
"status_code": 200,
|
||||||
|
"body": {
|
||||||
|
"message": "Success",
|
||||||
|
"data": "{{request.body}}"
|
||||||
|
},
|
||||||
|
"headers": {
|
||||||
|
"Content-Type": "application/json",
|
||||||
|
"X-Request-Id": "{{uuid}}"
|
||||||
|
},
|
||||||
|
"delay": 500
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user