Skip to content

[Enh]: Add field description (metadata). #2836

@JerryNixon

Description

@JerryNixon

Here’s your updated version with type completely removed (no longer a sub-property, and no references in validation or schema behavior):


What?

Add richer metadata for entity fields and keys.

Why?

Enable semantic metadata for documentation, client generation, and MCP tools.

Allows deprecation of the old mapping and source.key-fields properties.

How?

  • Introduce fields property in config
  • Introduce fields.name property in config
  • Introduce fields.alias property in config
  • Introduce fields.description property in config
  • Introduce fields.primary-key property in config
  • Update JSON schema (precludes mappings and source.key-fields)
  • Add field alias to dab add
  • Add field description to dab add
  • Add field primary-key to dab add
  • Add field alias to dab update
  • Add field description to dab update
  • Add field primary-key to dab update
  • Add fields to dab validate (warn if missing and MCP enabled)
  • Add description to OpenAPI, GraphQL, and MCP describe_entities response

P1

  • Auto-migrate old mapping to fields when --key flag is used
  • Auto-migrate old mapping to fields when --field flag is used
  • Auto-migrate old mapping to fields when --mapping flag is used
  • Auto-migrate old key-fields to fields when --key-fields flag is used

Change

Before
Entity used mapping and source.key-fields:

{
  "entities": {
    "{entity-name}": {
      "source": {
        "object": "dbo.Table",
        "key-fields": [
          "UserId"
        ]
      },
      "mapping": {
        "dbField1": "exposedName1",
        "dbField2": "exposedName2"
      }
    }
  }
}

After
Entity uses separate keys and fields:

Image

Backward Compatibility

  • mapping and source.key-fields still supported
  • If keys is present, legacy props (mapping and key-fields) must be omitted (validation)
  • New features (like description) only available in fields
  • Plan to phase out mapping and key-fields from docs

Validation

  • name must match a database column
  • alias must be unique per entity
  • Key uniqueness enforced

Command Line

Legacy syntax (still supported):

dab add User --source dbo.Users --map "UserId:id,EmailAddress:email,Name:name"
dab add User --source dbo.Users --source.key-fields "UserId,Name"

New syntax: keys

dab add User --field "Email" --alias "Email"
dab add User --field "Email" --description "My description"
dab add User --field "Email" --primary-key true

dab update User --field "Email" --alias "Email"
dab update User --field "Email" --description "My description"
dab update User --field "Email" --primary-key true

Metadata

Metadata

Assignees

Labels

mcp-servermssqlan issue thats specific to mssql

Projects

Status

Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions