Skip to content

Fix models elements min length#194

Open
MonkeyCanCode wants to merge 1 commit into
apache:mainfrom
MonkeyCanCode:fix_models_min_length
Open

Fix models elements min length#194
MonkeyCanCode wants to merge 1 commit into
apache:mainfrom
MonkeyCanCode:fix_models_min_length

Conversation

@MonkeyCanCode

@MonkeyCanCode MonkeyCanCode commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Looking at https://github.com/apache/ossie/blob/main/core-spec/osi-schema.json, from_columns, to_columns, and datasets should not allow empty list (which is the current behavior) as their min is 1 based on the spec:

    "Expression": {
      "type": "object",
      "description": "Expression definition with multi-dialect support",
      "properties": {
        "dialects": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/DialectExpression"
          },
          "minItems": 1
        }
      },

...

    "Relationship": {
      "type": "object",
      "description": "Foreign key relationship between datasets",
...
        "from_columns": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "minItems": 1,
          "description": "Foreign key columns in the 'from' dataset"
        },
        "to_columns": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "minItems": 1,
          "description": "Primary/unique key columns in the 'to' dataset"
        },

...

    "SemanticModel": {
      "type": "object",
      "description": "Top-level container representing a complete semantic model",
...
        "datasets": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/Dataset"
          },
          "minItems": 1,
          "description": "Collection of logical datasets"
        },
...

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.

@jbonofre
jbonofre self-requested a review July 14, 2026 18:43
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