Skip to content

Validate object-form semantic model dataset sources - #5406

Open
mattfaltyn wants to merge 2 commits into
apache:mainfrom
mattfaltyn:fix-5405-semantic-model-shape
Open

mattfaltyn wants to merge 2 commits into
apache:mainfrom
mattfaltyn:fix-5405-semantic-model-shape

Conversation

@mattfaltyn

@mattfaltyn mattfaltyn commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

Summary

Validate every dataset.source in single-object semantic-model documents and reject obsolete array or scalar roots. Apache Ossie PR #383 finalized one semantic model object per document, so Polaris now enforces that contract instead of retaining the temporary array form.

Previously, object documents bypassed source validation and could persist dangling table or view references. The OpenAPI example and tests now use the current 0.2.0.dev0 object form. Full Apache Ossie JSON Schema validation and document-size limits remain tracked by #5205.

Fixes #5405.

Validation

  • ./gradlew :polaris-extensions-semantic-models:test --tests "org.apache.polaris.service.catalog.semanticmodel.SemanticModelCatalogTest" --max-workers=1
  • ./gradlew format compileAll --max-workers=1
  • ./gradlew :polaris-core:check :polaris-extensions-semantic-models:check --max-workers=1

All commands pass on commit 6e1cbb0449 with OpenJDK 21.

AI assistance

AI assistance was used to investigate the defect, prepare the focused change, and run validation. The author reviewed and understands the implementation.

Checklist

  • 🛡️ Do not disclose security issues! (contact security@apache.org)
  • 🔗 Clearly explained why the changes are needed, or linked related issues: Fixes Semantic model object documents bypass dataset source validation #5405
  • 🧪 Added or updated tests with good coverage, or manually tested (and explained how)
  • 💡 Added comments for complex logic (no new complex logic was introduced)
  • 🧾 Updated CHANGELOG.md
  • 📚 Updated the OpenAPI example and Ossie version references

@github-project-automation github-project-automation Bot moved this to PRs In Progress in Basic Kanban Board Aug 28, 2026
@mattfaltyn
mattfaltyn marked this pull request as ready for review August 28, 2026 21:22
semantic_model:
type: string
description: The Apache Ossie semantic model serialized as a JSON string.
description: The Apache Ossie semantic model serialized as a JSON array string.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Semantic model itself has changed to a single object instead of an array. The array format only exist in a short period of time before 0.2.0.

https://github.com/apache/ossie/blob/ae3ee40fa5013091b0cc4aa13b231224d7ba86f6/core-spec/spec.yaml#L63

https://github.com/apache/ossie/blob/ae3ee40fa5013091b0cc4aa13b231224d7ba86f6/core-spec/ossie-schema.json#L6

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.

Semantic model itself has changed to a single object instead of an array.

Great catch—thank you! I updated the implementation so the single-object form now goes through the same dataset-source validation, while retaining the array path for compatibility. I also restored the object-form OpenAPI example and added focused regression coverage for an unresolved source in an object document.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I don't think we need to support the old version(0.1.x), given it is beta and created before the Apache Ossie incubation. Also it's a incompatible change, we may avoid that given Ossie community has moved on.

@mattfaltyn mattfaltyn Sep 2, 2026

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.

I don't think we need to support the old version (0.1.x)

Agreed on not preserving 0.1.x just for compatibility. One detail: both 0.1.1 and the linked 0.2.0.dev0 schema define semantic_model as an array; only the outer document is an object. Did you mean Polaris should intentionally unwrap a single model per entity? If so, I can align the contract.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Sorry, I thought it was changed to a single object from array already. Let me sync with the Ossie community a bit.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hi @mattfaltyn , we have fixed it in the Apache Ossie repo, Ossie PR #383.

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.

Hi @mattfaltyn, we have fixed it in the Apache Ossie repo, Ossie PR #383.

Thanks for the update! I aligned Polaris with the finalized Ossie contract: one JSON object is now required, arrays are rejected, and the examples use 0.2.0.dev0.

@mattfaltyn mattfaltyn changed the title Reject non-array semantic model documents Validate object-form semantic model dataset sources Sep 2, 2026
@mattfaltyn
mattfaltyn force-pushed the fix-5405-semantic-model-shape branch from 63f0558 to 6e1cbb0 Compare September 19, 2026 07:48
@mattfaltyn
mattfaltyn requested a review from flyrain September 19, 2026 07:59
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.

Semantic model object documents bypass dataset source validation

3 participants