Skip to content

DimensionsMetadata models lack schema validation; malformed dimensions.json fails late #60

@matt-edmondson

Description

@matt-edmondson

Summary

The deserialised metadata classes in Semantics.SourceGenerators/Models/ (e.g. DimensionsMetadata) accept any JSON shape. There is no post-deserialisation validation for required fields (Name, Symbol, base unit, supported forms), unit-string non-emptiness, or referential integrity across dotProducts / crossProducts / integrals / derivatives.

A malformed entry does not surface until the generator either crashes mid-emit or (more commonly, see #56) silently drops the operator.

Suggested next step

  • Add a Validate() method on DimensionsMetadata that runs after JSON deserialisation and throws (or reports diagnostics) for: missing Name/Symbol, empty availableUnits, undeclared form references, unknown referenced dimensions.
  • Run it once at the top of each generator pass and bail out with a clear diagnostic when validation fails.

Goes hand in hand with #56 (diagnostics for unresolved references).

Area / Severity

SourceGenerators / Metadata · cleanup

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions