Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions python/src/ossie/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ class OSIExpression(BaseModel):

model_config = ConfigDict(frozen=True)

dialects: list[OSIDialectExpression]
dialects: list[OSIDialectExpression] = Field(..., min_length=1)


class OSIDimension(BaseModel):
Expand Down Expand Up @@ -129,8 +129,8 @@ class OSIRelationship(BaseModel):
name: str
from_dataset: str = Field(..., alias="from")
to: str
from_columns: list[str]
to_columns: list[str]
from_columns: list[str] = Field(..., min_length=1)
to_columns: list[str] = Field(..., min_length=1)
ai_context: Optional[OSIAIContext] = None
custom_extensions: Optional[list[OSICustomExtension]] = None

Expand All @@ -155,7 +155,7 @@ class OSISemanticModel(BaseModel):
name: str
description: Optional[str] = None
ai_context: Optional[OSIAIContext] = None
datasets: list[OSIDataset]
datasets: list[OSIDataset] = Field(..., min_length=1)

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.

Can we leave datasets empty?

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.

From the spec, it should be min 1. Any reason to keep it empty?

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.

Will we reserve some empty datasets? I'm not entirely sure, but if you're sure about this, I think it's fine.

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.

Per the JSON schema (https://github.com/apache/ossie/blob/main/core-spec/osi-schema.json#L302), datasets has "minItems": 1. A semantic model with no datasets is meaningless. Also, as models are frozen, so we can't do incremental build case as well. I think keep the min of 1 here is more semantic correct as the spec itself doesn't allow empty.

relationships: Optional[list[OSIRelationship]] = None
metrics: Optional[list[OSIMetric]] = None
custom_extensions: Optional[list[OSICustomExtension]] = None
Expand Down