Skip to content

v1.1.0 — Custom Type Mapping Configuration

Choose a tag to compare

@Coding-Dev-Tools Coding-Dev-Tools released this 15 May 07:45
· 144 commits to master since this release

Custom Type Mapping Configuration

SchemaForge v1.1.0 introduces custom type mapping overrides. Users can now override any default type mapping per format via YAML or JSON config files.

New Feature: --type-map CLI option

schemaforge convert --from sql --to prisma --input schema.sql --type-map types.yaml

Template Variables in Override Strings

  • {length} — string/numeric length
  • {precision} — decimal precision
  • {scale} — decimal scale
  • {values} — comma-separated ENUM values

Example Config (types.yaml)

overrides:
  sql:
    STRING: "VARCHAR({length})"
    UUID: "UUID"
  prisma:
    STRING: "String @db.VarChar({length})"
    UUID: "String @uuid"
  sqlalchemy:
    STRING: "Unicode({length})"
    UUID: "Uuid"
    DATETIME: "DateTime(timezone=True)"

What Changed

  • TypeConfig: Load from .yaml/.yml/.json with template variable resolution
  • CLI: --type-map option added to convert command
  • All 7 generators forward type_config through resolve_type/build_type_string
  • has_type_override helper: generators skip special-case formatting when override is active
  • 282 new tests: 160/160 total passing
  • Sample fixture: fixtures/sample-type-overrides.yaml