updated modelgen tool

This commit is contained in:
2026-02-06 20:18:45 -03:00
parent 8f5d407e0e
commit 72e4113529
24 changed files with 321 additions and 938 deletions

View File

@@ -1,47 +1,12 @@
#!/bin/bash
# Model generation script for MPR
# Generates Django, Pydantic, TypeScript, and Protobuf from schema/models
# Generates all targets from schema/modelgen.json config
set -e
cd "$(dirname "$0")/.."
echo "Generating models from schema/models..."
# Django ORM models: domain models + enums
python -m modelgen from-schema \
--schema schema/models \
--output mpr/media_assets/models.py \
--targets django \
--include dataclasses,enums
# Pydantic schemas for FastAPI: domain models + enums
python -m modelgen from-schema \
--schema schema/models \
--output api/schemas/models.py \
--targets pydantic \
--include dataclasses,enums
# TypeScript types for Timeline UI: domain models + enums + API types
python -m modelgen from-schema \
--schema schema/models \
--output ui/timeline/src/types.ts \
--targets typescript \
--include dataclasses,enums,api
# Graphene types for GraphQL: domain models + enums + API types
python -m modelgen from-schema \
--schema schema/models \
--output api/schemas/graphql.py \
--targets graphene \
--include dataclasses,enums,api
# Protobuf for gRPC: gRPC messages + service
python -m modelgen from-schema \
--schema schema/models \
--output rpc/protos/worker.proto \
--targets proto \
--include grpc
python -m modelgen generate --config schema/modelgen.json
# Generate gRPC stubs from proto
echo "Generating gRPC stubs..."