This commit is contained in:
1 parent
4db3f45164
commit
d25c04cdd2
175 files changed
+56243
-15
No files matched your search
@@ -0,0 +1,64 @@
|
||||
"""Export public Pydantic records as versioned JSON Schemas."""
|
||||
|
||||
import json
|
||||
from pathlib import Path
|
||||
|
||||
from gewu.domain.contracts import (
|
||||
AcceptanceManifest,
|
||||
AutoAcceptPolicy,
|
||||
DomainError,
|
||||
ExtractionRecord,
|
||||
KnowledgeNode,
|
||||
NeighborRequest,
|
||||
ProjectRecord,
|
||||
ProposalReceipt,
|
||||
ProposalRevision,
|
||||
ProposalStatus,
|
||||
ReadEnvelope,
|
||||
RunCheckpointRequest,
|
||||
RunCreateRequest,
|
||||
RunRecord,
|
||||
Scope,
|
||||
SearchRequest,
|
||||
ServiceDiagnostics,
|
||||
SourceRevisionRecord,
|
||||
TypedEdge,
|
||||
)
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
DESTINATION = ROOT / "schema" / "v1" / "records"
|
||||
MODELS = (
|
||||
AcceptanceManifest,
|
||||
AutoAcceptPolicy,
|
||||
DomainError,
|
||||
ExtractionRecord,
|
||||
KnowledgeNode,
|
||||
NeighborRequest,
|
||||
ProjectRecord,
|
||||
ProposalReceipt,
|
||||
ProposalRevision,
|
||||
ProposalStatus,
|
||||
ReadEnvelope,
|
||||
ServiceDiagnostics,
|
||||
RunCheckpointRequest,
|
||||
RunCreateRequest,
|
||||
RunRecord,
|
||||
SearchRequest,
|
||||
Scope,
|
||||
SourceRevisionRecord,
|
||||
TypedEdge,
|
||||
)
|
||||
|
||||
|
||||
def main() -> None:
|
||||
DESTINATION.mkdir(parents=True, exist_ok=True)
|
||||
for model in MODELS:
|
||||
output = DESTINATION / f"{model.__name__}.schema.json"
|
||||
output.write_text(
|
||||
json.dumps(model.model_json_schema(mode="validation"), indent=2, sort_keys=True) + "\n",
|
||||
encoding="utf-8",
|
||||
)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in new issue
Block a user