Refactor DTO classes to use model_config with ConfigDict for attribute handling
- Updated multiple DTO classes across various modules to replace the `Config` class with `model_config = ConfigDict(from_attributes=True)`. - This change enhances consistency in attribute handling and aligns with the latest Pydantic practices. - Adjusted error handling in core modules to change status codes from `HTTP_422_UNPROCESSABLE_ENTITY` to `HTTP_422_UNPROCESSABLE_CONTENT` for improved clarity in validation responses.
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
"""ALADI2 Schemas"""
|
||||
|
||||
from typing import Optional
|
||||
from pydantic import BaseModel, Field
|
||||
from pydantic import BaseModel, ConfigDict, Field
|
||||
|
||||
|
||||
class Aladi2Response(BaseModel):
|
||||
@@ -20,5 +20,4 @@ class Aladi2Response(BaseModel):
|
||||
NICO: Optional[str] = Field(None, max_length=2)
|
||||
SYSID: int
|
||||
|
||||
class Config:
|
||||
from_attributes = True
|
||||
model_config = ConfigDict(from_attributes=True)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
"""Cuotas2 Schemas"""
|
||||
|
||||
from typing import Optional
|
||||
from pydantic import BaseModel, Field
|
||||
from pydantic import BaseModel, ConfigDict, Field
|
||||
|
||||
|
||||
class Cuotas2Response(BaseModel):
|
||||
@@ -26,5 +26,4 @@ class Cuotas2Response(BaseModel):
|
||||
NICO: Optional[str] = Field("", max_length=2)
|
||||
SYSID: int
|
||||
|
||||
class Config:
|
||||
from_attributes = True
|
||||
model_config = ConfigDict(from_attributes=True)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
"""Cupos Schemas"""
|
||||
|
||||
from typing import Optional
|
||||
from pydantic import BaseModel, Field
|
||||
from pydantic import BaseModel, ConfigDict, Field
|
||||
|
||||
|
||||
class CuposResponse(BaseModel):
|
||||
@@ -21,5 +21,4 @@ class CuposResponse(BaseModel):
|
||||
NICO: Optional[str] = Field("", max_length=2)
|
||||
SYSID: int
|
||||
|
||||
class Config:
|
||||
from_attributes = True
|
||||
model_config = ConfigDict(from_attributes=True)
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
from decimal import Decimal
|
||||
from typing import Optional
|
||||
from pydantic import BaseModel, Field
|
||||
from pydantic import BaseModel, ConfigDict, Field
|
||||
|
||||
|
||||
class FraccionesResponse(BaseModel):
|
||||
@@ -35,5 +35,4 @@ class FraccionesResponse(BaseModel):
|
||||
NICO: Optional[str] = Field(None, max_length=14)
|
||||
SYSID: Optional[int] = None
|
||||
|
||||
class Config:
|
||||
from_attributes = True
|
||||
model_config = ConfigDict(from_attributes=True)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
"""Fracciones Anteriores Schemas"""
|
||||
|
||||
from typing import Optional
|
||||
from pydantic import BaseModel, Field
|
||||
from pydantic import BaseModel, ConfigDict, Field
|
||||
|
||||
|
||||
class FraccionesAnterioresResponse(BaseModel):
|
||||
@@ -11,5 +11,4 @@ class FraccionesAnterioresResponse(BaseModel):
|
||||
FRACCIONANTERIOR: Optional[str] = Field(None, max_length=10)
|
||||
SYSID: int
|
||||
|
||||
class Config:
|
||||
from_attributes = True
|
||||
model_config = ConfigDict(from_attributes=True)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
"""Fracciones USA Schemas"""
|
||||
|
||||
from typing import Optional
|
||||
from pydantic import BaseModel, Field
|
||||
from pydantic import BaseModel, ConfigDict, Field
|
||||
|
||||
|
||||
class FraccionesUSAResponse(BaseModel):
|
||||
@@ -20,5 +20,4 @@ class FraccionesUSAResponse(BaseModel):
|
||||
NOTAS: Optional[str] = None
|
||||
CONSECUTIVO: int
|
||||
|
||||
class Config:
|
||||
from_attributes = True
|
||||
model_config = ConfigDict(from_attributes=True)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
"""Fundamentos TLC Schemas"""
|
||||
|
||||
from typing import Optional
|
||||
from pydantic import BaseModel, Field
|
||||
from pydantic import BaseModel, ConfigDict, Field
|
||||
|
||||
|
||||
class FundamentosTLCResponse(BaseModel):
|
||||
@@ -23,5 +23,4 @@ class FundamentosTLCResponse(BaseModel):
|
||||
NICO: Optional[str] = Field("", max_length=2)
|
||||
SYSID: int
|
||||
|
||||
class Config:
|
||||
from_attributes = True
|
||||
model_config = ConfigDict(from_attributes=True)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
"""IEPS Schemas"""
|
||||
|
||||
from typing import Optional
|
||||
from pydantic import BaseModel, Field
|
||||
from pydantic import BaseModel, ConfigDict, Field
|
||||
|
||||
|
||||
class IepsResponse(BaseModel):
|
||||
@@ -16,5 +16,4 @@ class IepsResponse(BaseModel):
|
||||
NICO: Optional[str] = Field("", max_length=2)
|
||||
CONSECUTIVO: int
|
||||
|
||||
class Config:
|
||||
from_attributes = True
|
||||
model_config = ConfigDict(from_attributes=True)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
"""Información General Schemas"""
|
||||
|
||||
from typing import Optional
|
||||
from pydantic import BaseModel, Field
|
||||
from pydantic import BaseModel, ConfigDict, Field
|
||||
|
||||
|
||||
class InformacionGeneralResponse(BaseModel):
|
||||
@@ -17,5 +17,4 @@ class InformacionGeneralResponse(BaseModel):
|
||||
NICO: Optional[str] = Field("", max_length=2)
|
||||
SYSID: int
|
||||
|
||||
class Config:
|
||||
from_attributes = True
|
||||
model_config = ConfigDict(from_attributes=True)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
"""NOMs Schemas"""
|
||||
|
||||
from typing import Optional
|
||||
from pydantic import BaseModel, Field
|
||||
from pydantic import BaseModel, ConfigDict, Field
|
||||
|
||||
|
||||
class NomsResponse(BaseModel):
|
||||
@@ -23,5 +23,4 @@ class NomsResponse(BaseModel):
|
||||
PAIS: Optional[str] = Field("", max_length=3)
|
||||
SYSID: int
|
||||
|
||||
class Config:
|
||||
from_attributes = True
|
||||
model_config = ConfigDict(from_attributes=True)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
"""Precios Estimados Schemas"""
|
||||
|
||||
from typing import Optional
|
||||
from pydantic import BaseModel, Field
|
||||
from pydantic import BaseModel, ConfigDict, Field
|
||||
|
||||
|
||||
class PreciosEstimados2Response(BaseModel):
|
||||
@@ -14,5 +14,4 @@ class PreciosEstimados2Response(BaseModel):
|
||||
NICO: Optional[str] = Field("", max_length=2)
|
||||
SYSID: int
|
||||
|
||||
class Config:
|
||||
from_attributes = True
|
||||
model_config = ConfigDict(from_attributes=True)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
"""PROSEC Schemas"""
|
||||
|
||||
from typing import Optional
|
||||
from pydantic import BaseModel, Field
|
||||
from pydantic import BaseModel, ConfigDict, Field
|
||||
|
||||
|
||||
class ProsecResponse(BaseModel):
|
||||
@@ -17,5 +17,4 @@ class ProsecResponse(BaseModel):
|
||||
NICO: Optional[str] = Field("", max_length=2)
|
||||
SYSID: int
|
||||
|
||||
class Config:
|
||||
from_attributes = True
|
||||
model_config = ConfigDict(from_attributes=True)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
"""RCG2 Schemas"""
|
||||
|
||||
from typing import Optional
|
||||
from pydantic import BaseModel, Field
|
||||
from pydantic import BaseModel, ConfigDict, Field
|
||||
|
||||
|
||||
class Rcg2Response(BaseModel):
|
||||
@@ -22,5 +22,4 @@ class Rcg2Response(BaseModel):
|
||||
NICO: Optional[str] = Field("", max_length=2)
|
||||
SYSID: int
|
||||
|
||||
class Config:
|
||||
from_attributes = True
|
||||
model_config = ConfigDict(from_attributes=True)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
"""Regulaciones Schemas"""
|
||||
|
||||
from typing import Optional
|
||||
from pydantic import BaseModel, Field
|
||||
from pydantic import BaseModel, ConfigDict, Field
|
||||
|
||||
|
||||
class RegulacionesResponse(BaseModel):
|
||||
@@ -15,5 +15,4 @@ class RegulacionesResponse(BaseModel):
|
||||
NICO: Optional[str] = Field("", max_length=2)
|
||||
SYSID: int
|
||||
|
||||
class Config:
|
||||
from_attributes = True
|
||||
model_config = ConfigDict(from_attributes=True)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
"""REIT Schemas"""
|
||||
|
||||
from typing import Optional
|
||||
from pydantic import BaseModel, Field
|
||||
from pydantic import BaseModel, ConfigDict, Field
|
||||
|
||||
|
||||
class ReitResponse(BaseModel):
|
||||
@@ -21,5 +21,4 @@ class ReitResponse(BaseModel):
|
||||
NICO: Optional[str] = Field("", max_length=2)
|
||||
SYSID: int
|
||||
|
||||
class Config:
|
||||
from_attributes = True
|
||||
model_config = ConfigDict(from_attributes=True)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
"""Requisito Previo Schemas"""
|
||||
|
||||
from typing import Optional
|
||||
from pydantic import BaseModel, Field
|
||||
from pydantic import BaseModel, ConfigDict, Field
|
||||
|
||||
|
||||
class RequisitoPrevioResponse(BaseModel):
|
||||
@@ -24,5 +24,4 @@ class RequisitoPrevioResponse(BaseModel):
|
||||
NICO: Optional[str] = Field("", max_length=2)
|
||||
SYSID: int
|
||||
|
||||
class Config:
|
||||
from_attributes = True
|
||||
model_config = ConfigDict(from_attributes=True)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
"""TLCS Schemas"""
|
||||
|
||||
from typing import Optional
|
||||
from pydantic import BaseModel, Field
|
||||
from pydantic import BaseModel, ConfigDict, Field
|
||||
|
||||
|
||||
class TLCSResponse(BaseModel):
|
||||
@@ -19,5 +19,4 @@ class TLCSResponse(BaseModel):
|
||||
NICO: Optional[str] = Field("", max_length=2)
|
||||
SYSID: int
|
||||
|
||||
class Config:
|
||||
from_attributes = True
|
||||
model_config = ConfigDict(from_attributes=True)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
"""Vehiculos Marcas Schemas"""
|
||||
|
||||
from typing import Optional
|
||||
from pydantic import BaseModel, Field
|
||||
from pydantic import BaseModel, ConfigDict, Field
|
||||
|
||||
|
||||
class VehiculosMarcasResponse(BaseModel):
|
||||
@@ -11,5 +11,4 @@ class VehiculosMarcasResponse(BaseModel):
|
||||
MARCA: Optional[str] = Field(None, max_length=60)
|
||||
SYSID: int
|
||||
|
||||
class Config:
|
||||
from_attributes = True
|
||||
model_config = ConfigDict(from_attributes=True)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
"""Vehiculos Modelos Schemas"""
|
||||
|
||||
from typing import Optional
|
||||
from pydantic import BaseModel, Field
|
||||
from pydantic import BaseModel, ConfigDict, Field
|
||||
|
||||
|
||||
class VehiculosModelosResponse(BaseModel):
|
||||
@@ -34,5 +34,4 @@ class VehiculosModelosResponse(BaseModel):
|
||||
A1: Optional[str] = Field(None, max_length=19)
|
||||
SYSID: int
|
||||
|
||||
class Config:
|
||||
from_attributes = True
|
||||
model_config = ConfigDict(from_attributes=True)
|
||||
|
||||
Reference in New Issue
Block a user