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 both single-object and array-form semantic-model documents.
Previously, resolveAndValidateSources returned without checking any source when a client supplied
an object, so create and update could persist dangling table or view references.

The OpenAPI example remains in the single-object form. Array documents continue through the same
source validation for compatibility. 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'
  • ./gradlew format compileAll --max-workers=1
  • ./gradlew :polaris-extensions-semantic-models:check --max-workers=1

All commands pass on the final commit 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

  • 🛡️ Don't 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/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 (if needed)
  • 📚 Updated documentation in site/content/in-dev/unreleased (not needed; the existing object-form OpenAPI example remains accurate)

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

@mattfaltyn mattfaltyn changed the title Reject non-array semantic model documents Validate object-form semantic model dataset sources Sep 2, 2026
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