Skip to content

Make the spec's own examples validate against osi-schema.json#209

Open
Pawansingh3889 wants to merge 1 commit into
apache:mainfrom
Pawansingh3889:fix/spec-examples-validate
Open

Make the spec's own examples validate against osi-schema.json#209
Pawansingh3889 wants to merge 1 commit into
apache:mainfrom
Pawansingh3889:fix/spec-examples-validate

Conversation

@Pawansingh3889

Copy link
Copy Markdown

Four small fixes so the examples in core-spec agree with the rules osi-schema.json already states:

  1. The Semantic Model section example used datasets: [], which violates the schema's minItems: 1; it now carries one minimal dataset.
  2. Both metric examples (total_revenue, avg_orders) wrote expression: as a bare list, omitting the required dialects wrapper that the Expression Object section directly above them defines. They now match the schema and the Complete Example.
  3. The Complete Example presented a full document without the required top-level version key; it now begins with version: 0.2.0.dev0.
  4. spec.yaml's commented primary_key examples showed a nested list (- [customer_id]) while the schema defines primary_key as a flat array of strings; the comments now show the flat form used by the schema and by spec.md's own inline examples.

Verification: extracted each fixed example and ran it through validation/validate.py (JSON Schema, name uniqueness, relationship references, sqlglot SQL checks) — all pass, including the Complete Example verbatim as a full document.

Found while building an OSI exporter for a governed semantic-layer tool; happy to adjust scope if the section examples are intentionally fragments.

Four fixes, each aligning an example with a rule the schema already
states:

- The Semantic Model section example used datasets: [], violating the
  schema's minItems: 1; it now carries one minimal dataset.
- Both metric examples (total_revenue, avg_orders) wrote expression as a
  bare list, omitting the required dialects wrapper that the Expression
  Object section above them defines; they now match the schema and the
  Complete Example.
- The Complete Example presented a full document without the required
  top-level version key; it now begins with version: 0.2.0.dev0.
- spec.yaml's commented primary_key examples showed a nested list
  (- [customer_id]) while the schema defines primary_key as a flat array
  of strings; the comments now show the flat form the schema and
  spec.md's own examples use.

Verified by extracting each fixed example and running it through
validation/validate.py (schema, uniqueness, references and sqlglot
checks): all pass, including the Complete Example verbatim.

Signed-off-by: Pawan Singh Kapkoti <42340841+Pawansingh3889@users.noreply.github.com>

@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 catch. @khush-bhatia ok for you?

@jbonofre
jbonofre requested a review from khush-bhatia July 17, 2026 05:34
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.

2 participants