46 lines
1.2 KiB
Python
46 lines
1.2 KiB
Python
from __future__ import annotations
|
|
|
|
from datetime import datetime
|
|
from typing import Any
|
|
|
|
from pydantic import BaseModel, ConfigDict, Field
|
|
|
|
|
|
class FormDefinitionWriteRequest(BaseModel):
|
|
model_config = ConfigDict(extra="forbid")
|
|
|
|
definition: dict[str, Any]
|
|
expected_revision: str | None = Field(default=None, min_length=1, max_length=255)
|
|
|
|
|
|
class FormDefinitionListResponse(BaseModel):
|
|
definitions: list[dict[str, Any]]
|
|
total: int
|
|
|
|
|
|
class FormDefinitionHistoryResponse(BaseModel):
|
|
revisions: list[dict[str, Any]]
|
|
|
|
|
|
class FormPackageRequest(BaseModel):
|
|
model_config = ConfigDict(extra="forbid")
|
|
|
|
fragment: dict[str, Any]
|
|
|
|
|
|
class FormPackageImportRequest(FormPackageRequest):
|
|
target_form_id: str | None = Field(default=None, min_length=1, max_length=255)
|
|
target_key: str | None = Field(default=None, min_length=1, max_length=255)
|
|
expected_revision: str | None = Field(default=None, min_length=1, max_length=255)
|
|
change_reason: str = Field(min_length=1, max_length=1000)
|
|
recorded_at: datetime
|
|
|
|
|
|
__all__ = [
|
|
"FormDefinitionHistoryResponse",
|
|
"FormDefinitionListResponse",
|
|
"FormDefinitionWriteRequest",
|
|
"FormPackageImportRequest",
|
|
"FormPackageRequest",
|
|
]
|