From 845aab24cd3e65c85f37772cfdfd905fc5595d2e Mon Sep 17 00:00:00 2001 From: Backend IM Bot Date: Wed, 26 Mar 2025 13:03:53 +0000 Subject: [PATCH] Add Country schema --- schemas/country.py | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/schemas/country.py b/schemas/country.py index 35f6b21..ef97f23 100644 --- a/schemas/country.py +++ b/schemas/country.py @@ -2,29 +2,25 @@ from pydantic import BaseModel, Field from typing import Optional class CountryBase(BaseModel): - name: str = Field(..., min_length=1, description="Country name") - code: str = Field(..., min_length=2, max_length=3, description="Country code") - flag: Optional[str] = Field(None, description="Country flag URL") + name: str = Field(..., description="Country name") + code: str = Field(..., description="Country code", min_length=2, max_length=3) capital: Optional[str] = Field(None, description="Capital city") region: Optional[str] = Field(None, description="Geographic region") subregion: Optional[str] = Field(None, description="Geographic subregion") - population: Optional[str] = Field(None, description="Population count") - languages: Optional[str] = Field(None, description="Official languages") - currencies: Optional[str] = Field(None, description="Official currencies") + population: Optional[str] = Field(None, description="Country population") + flag: Optional[str] = Field(None, description="Country flag URL") class CountryCreate(CountryBase): class Config: schema_extra = { "example": { "name": "United States", - "code": "USA", - "flag": "https://example.com/us-flag.png", + "code": "US", "capital": "Washington, D.C.", "region": "Americas", "subregion": "North America", "population": "331,002,651", - "languages": "English", - "currencies": "USD" + "flag": "https://example.com/us-flag.png" } } @@ -37,13 +33,11 @@ class Country(CountryBase): "example": { "id": 1, "name": "United States", - "code": "USA", - "flag": "https://example.com/us-flag.png", + "code": "US", "capital": "Washington, D.C.", "region": "Americas", "subregion": "North America", "population": "331,002,651", - "languages": "English", - "currencies": "USD" + "flag": "https://example.com/us-flag.png" } } \ No newline at end of file