Skip to content

cross-port: verify+fix field.string @dbColumnType:jsonb → validator/DTO typing in C#/Python/Java/Kotlin (TS fixed in #97) #98

Description

@dmealing

Follow-up to #97 (the TypeScript fix).

Context

@dbColumnType: jsonb on a field.string is the sanctioned "open JSON bag" pattern. The physical column is jsonb (returns a parsed JSON value), but @dbColumnType is a physical override — the logical subtype stays string. In TS, the Zod + TS-type emitters therefore typed the field as a string while the column returned an object (fixed in #97z.unknown() / unknown).

Ask

The same logical miss likely exists in the other ports' generated validation / DTO code, since each emits per-port-idiomatic validators/DTOs off the logical subtype:

  • Python — Pydantic model field type for field.string @dbColumnType:jsonb (should be Any / dict | list | ..., not str).
  • C# — DTO property type + any DataAnnotations (should be a JSON-capable type, not string).
  • Java — DTO/record field type + Jackson handling.
  • Kotlin — data-class property type.

This is not yet confirmed per-port — each port's column-mapper + validator/DTO emitter needs to be read to confirm (a) it honors @dbColumnType: jsonb (emits a jsonb/json physical column) and (b) whether its DTO/validator then mistypes the field as a string. Do not assume; verify against the actual emitter + a generated-output sample (the TS investigation found two sibling "bugs" that turned out to be false positives, so confirm before fixing).

Gate

@dbColumnType: jsonb legal-pairing is already registered (DB_COLUMN_TYPE_LEGAL_SUBTYPES[jsonb] = [field.string]), so no registry-conformance change. Add a per-port codegen/validation test asserting the open-JSON (not string) shape — validation/DTO emission is per-port-idiomatic (not byte-identical render-conformance), so each port gates its own.

Surfaced via the metaobjects-audit skill against a real adopter; TS confirmed + fixed in #97.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions