The Python SDK models are planned as Pydantic v2 models generated from the official OpenAPI contract. Generated models are the source for runtime validation, JSON serialization and field reflection.
Python names and JSON aliases
Python code uses snake_case field names. JSON sent to the API uses the backend camelCase aliases.
from conformaesg.models import SupplierCreatepayload = SupplierCreate(name="Acme Textiles Ltd",vat_number="IT01234567890",contact_email="procurement@example.com",)json_payload = payload.model_dump(by_alias=True, exclude_none=True)
The serialized payload uses aliases such as vatNumber and contactEmail.
Input and response validation
Input payloads are validated before the HTTP request. JSON responses are validated before they are returned to application code.
from pydantic import ValidationErrorfrom conformaesg.models import SupplierCreatetry:SupplierCreate(name="", category="TEXTILES")except ValidationError as exc:print(exc.errors())
Validation errors should include the field path and OpenAPI description when the generated schema provides one.
Reflection API
Generated models expose field metadata for dynamic forms, import mappers and admin tooling:
from conformaesg.models import SupplierCreatefor field in SupplierCreate.describe_fields():print(field.name, field.python_name, field.alias, field.required)print(SupplierCreate.field_description("vat_number"))print(SupplierCreate.model_json_schema())
describe_fields() returns stable metadata:
[FieldInfo(name="vat_number",python_name="vat_number",alias="vatNumber",type="str",required=False,description="Description from OpenAPI when available.",examples=[],)]
Field descriptions must come from OpenAPI. If a description is missing or too vague, update the backend DTO/OpenAPI source in a separate API workstream rather than writing divergent SDK-only descriptions.
Type checking
The package is planned as type-aware through py.typed.
Recommended project setup:
[tool.mypy]python_version = "3.10"strict = true
or configure Pyright in strict mode. Public SDK methods should have concrete payload and response types, not dict[str, Any] as the main API surface.