Skip to content

Field naming: ADR + non-technical guide + enforcement (source-standard names vs LIF/tech constraints) #1014

Description

@bjagg

Describe the issue

LIF ingests field names from external standards and source systems (CEDS, IMS, …) into the MDR, and those names don't always satisfy LIF's naming convention or the constraints of the technologies that consume the model. The iSO639-2LangCode incident (#1011) is a concrete failure: a hyphenated, non-camelCase CEDS attribute reached the MDR and crashed GraphQL schema generation in dev and demo.

Three pressures conflict, and there's no recorded decision reconciling them:

  • Source standards deliver names like iSO639-2LangCode (hyphens, irregular caps).
  • LIF convention (docs/specs/data-model-rules.md → Naming Styles): PascalCase entities, camelCase scalar leaves, PascalCase enums.
  • Technology constraints: GraphQL names must match /[_A-Za-z][_0-9A-Za-z]*/ (no hyphen, no leading digit); Python attrs are snake_cased; JSON/Mongo store verbatim; the translator relies on case-insensitive lookups.

data-model-rules.md documents the rule but not the conflict or a decision, and explicitly notes the convention is "enforced by readers, not tooling" — which is how the bad names slipped in. (Analogous to the classic Clojure kebab-case vs JSON/DynamoDB tension.)

Deliverables

  1. ADR (docs/design/adr/data_model/0001-…) capturing the conflict, options, and a ratified decision (e.g. normalize-on-ingest + preserve source name as metadata, and/or reject-illegal-at-MDR-write-time). Draft PR incoming (status: Proposed) for the team to react to.
  2. Non-technical naming guide for schema designers / CEDS contributors — plain-language "name fields like this, not that, and why."
  3. Enforcement — lint for the checked-in convention files and/or MDR write-time validation, so the convention can't silently drift again. (Relates to the unenforced-convention gap and the uniqueness work in Ensure the MDR API enforces unique names of _anything_ that can be exportable (schemas or mappings) #746.)

Related: #1011 / #1012 (crash + codegen hardening — defense-in-depth, not a substitute for a naming policy), #1013 (rename the three iSO639-* fields).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status
    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions