docs(spec): align spec.yaml ai_context with the schema at every node - #350
Conversation
Relationship was the only node where spec.yaml and the JSON schema disagreed on whether a field exists at all: the schema's $defs/Relationship carries ai_context (as does the spec.md table), but the spec.yaml relationships block omitted it. Every other node lists it in both files. Comment style and placement (before custom_extensions) follow the sibling nodes. Signed-off-by: km <kayemkim@gmail.com> Generated-by: Claude Code
425ea55 to
509e849
Compare
|
|
||
| # Optional: Additional context for AI tools (e.g., synonyms, business context) | ||
| # Helps LLMs understand when and why the datasets should be joined | ||
| ai_context: string |
There was a problem hiding this comment.
The schema, spec.md, the Python models, and the TPC-DS example all treat relationship ai_context as string-or-object. This PR fixes "field is missing" and introduces "field has the wrong type" (corresponding to #141).
I think it's worth changing to reflect both forms before merge, since spec.yaml handles nested shapes elsewhere (expressions, dimensions).
There was a problem hiding this comment.
Agreed. Pushed a change that documents the object form (instructions/synonyms/examples) in a comment above the field, the way primary_key and unique_keys show their alternate shapes. I kept the live value as ai_context: string to stay in line with the sibling nodes, since reworking the string-only notation across the file is what #141 tracks; or I can switch the live value to the nested form if you'd rather lead with it here.
Review feedback: the schema's AIContext is string-or-object, so a bare "ai_context: string" traded the missing-field drift for a wrong-type drift. Document the object form (instructions/synonyms/examples) in a comment, the same way primary_key and unique_keys show their alternate shapes, keeping the live value in line with the sibling nodes until the string-only notation is reworked across the file. Signed-off-by: km <kayemkim@gmail.com> Generated-by: Claude Code
The schema's AIContext is string-or-object with additionalProperties, so neither a bare "ai_context: string" nor a closed list of three subfields describes it. Use the notation the spec-wide alignment review settled on: an empty map as the live value, with the string form and the optional keys in the comment above it, pointing at AIContext in the JSON schema. Signed-off-by: km <kayemkim@gmail.com> Generated-by: Claude Code
Relationship was not the only node where spec.yaml understated the field: semantic_model, datasets, fields and metrics all wrote "ai_context: string" while the schema, spec.md and the canonical example treat it as string-or-object with additional keys allowed. Leaving them as they were would have put two notations for the same field in one file. All five sites now use the open map, with the two accepted forms spelled out once where the field first appears and a pointer to AIContext in the JSON schema at each site. Signed-off-by: km <kayemkim@gmail.com> Generated-by: Claude Code
|
I went back through the history on this, and the notation question already has an answer in the tracker. #141 proposes this exact form in its suggested resolution, khush-bhatia asked for it on #221 (spelling out instructions, synonyms and examples as a fixed set understates AIContext, which sets additionalProperties: true), and you agreed with it there. #221 has had changes requested since July 17 without being picked back up, so instead of asking you to choose between the two options I raised earlier, I have applied that form here: The first commit puts the Relationship node in that form. The second extends it to semantic_model, datasets, fields and metrics, which all still read spec.yaml still parses, and $defs for all five nodes reference AIContext. |
Summary
spec.yamlunderstatedai_contextin two different ways. OnRelationshipthe field was missing outright, even though the JSON schema's$defs/Relationshipcarries it and the spec.md property table lists it. On the other four nodes it was written asai_context: string, while the schema defines AIContext as string-or-object withadditionalProperties: true, spec.md documents it asstring/objectat all five nodes, and the canonical TPC-DS example uses the object form.The notation is the one suggested in #141 and asked for during the review of #221: an open map as the value, the two accepted forms spelled out once where the field first appears, and a pointer to AIContext in the JSON schema at each site. Nothing normative changes. The JSON schema is untouched and already accepts both forms, as do the Python models.
The first commit adds the field to
Relationship, the second aligns the remaining four nodes.spec.yamlstill parses.Related Issues
Fixes #340. Also covers #141, which asked for exactly this alignment; #221 proposed it as well but has had changes requested since July without an update.