Skip to content

docs(spec): align spec.yaml ai_context with the schema at every node - #350

Merged
jbonofre merged 4 commits into
apache:mainfrom
kayemkim:fix/spec-yaml-relationship-ai-context
Sep 9, 2026
Merged

docs(spec): align spec.yaml ai_context with the schema at every node#350
jbonofre merged 4 commits into
apache:mainfrom
kayemkim:fix/spec-yaml-relationship-ai-context

Conversation

@kayemkim

@kayemkim kayemkim commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Summary

spec.yaml understated ai_context in two different ways. On Relationship the field was missing outright, even though the JSON schema's $defs/Relationship carries it and the spec.md property table lists it. On the other four nodes it was written as ai_context: string, while the schema defines AIContext as string-or-object with additionalProperties: true, spec.md documents it as string/object at 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.yaml still 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.

@jbonofre
jbonofre self-requested a review August 31, 2026 14:03
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
@kayemkim
kayemkim force-pushed the fix/spec-yaml-relationship-ai-context branch from 425ea55 to 509e849 Compare September 1, 2026 00:11
Comment thread core-spec/spec.yaml Outdated

# 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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
@kayemkim
kayemkim requested a review from jbonofre September 1, 2026 23:40
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
@kayemkim kayemkim changed the title docs(spec): add ai_context to the Relationship node in spec.yaml docs(spec): align spec.yaml ai_context with the schema at every node Sep 9, 2026
@kayemkim

kayemkim commented Sep 9, 2026

Copy link
Copy Markdown
Contributor Author

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:

# Optional: Additional context for AI tools (e.g., custom prompts, instructions)
# Can be either:
#   - A free-form string, or
#   - A structured object with optional keys:
#       instructions: string  # how AI should use this entity
#       synonyms:     []      # alternative names / terms
#       examples:     []      # sample questions or use cases
#     (additionalProperties: true, so vendors may add more keys)
ai_context: {}  # see AIContext in ossie-schema.json

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 ai_context: string: fixing only Relationship would leave two notations for the same field in one file, and spec.md already documents string/object at all five nodes. That covers #141 as well. If you would rather keep this PR to the single node it started with, dropping the second commit does that.

spec.yaml still parses, and $defs for all five nodes reference AIContext.

@jbonofre jbonofre left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good one! Thanks!

@jbonofre
jbonofre merged commit 91045ce into apache:main Sep 9, 2026
0 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

core-spec/spec.yaml omits ai_context on Relationship, while the JSON schema defines it

2 participants