Skip to content

chore(mdl): update the JSON schema of WrenMDL#1934

Merged
douenergy merged 3 commits intomainfrom
feat/mdl-spec-update
Sep 26, 2025
Merged

chore(mdl): update the JSON schema of WrenMDL#1934
douenergy merged 3 commits intomainfrom
feat/mdl-spec-update

Conversation

@goldmedal
Copy link
Copy Markdown
Collaborator

@goldmedal goldmedal commented Sep 3, 2025

Description

  • add the new field
    • row level access control
    • colum level access control
    • isHidden for column
    • data source
    • sampleDataFolder
  • Remove the legacy field
    • macros
    • cumulativeMetrics
    • dateSpine

Summary by CodeRabbit

  • New Features

    • Column-level visibility (isHidden) and column-level access controls.
    • Reusable sessionProperty for access rules.
    • Row-level access controls for models.
    • New root options: sampleDataFolder and dataSource.
  • Changes

    • Expanded additionalProperties to accept string, number, boolean, object, array, and null across models, relationships, metrics, views, and enums.
    • Several public descriptions marked as WIP.
  • Removals

    • Deprecated: macros, cumulativeMetrics, dateSpine.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Sep 3, 2025

Walkthrough

The JSON Schema for wren-mdl was updated to add column- and row-level access control constructs, introduce a reusable sessionProperty definition, expand root fields (sampleDataFolder, dataSource), broaden additionalProperties types across several public definitions, and remove legacy macros/cumulativeMetrics/dateSpine sections.

Changes

Cohort / File(s) Summary of changes
Root manifest additions
wren-mdl/mdl.schema.json
Added root fields: sampleDataFolder (string, minLength 1) and dataSource (string enum, minLength 1).
Column-level access control
wren-mdl/mdl.schema.json
Added isHidden (boolean) and columnLevelAccessControl rule structure with name, operator (enum), requiredProperties (refs to $defs/sessionProperty), and optional threshold (value + dataType of NUMERIC or STRING).
Row-level access control (models)
wren-mdl/mdl.schema.json
Added models[].rowLevelAccessControls: array of rules with name, requiredProperties (array of $defs/sessionProperty), and condition.
Reusable session property
wren-mdl/mdl.schema.json
Introduced $defs/sessionProperty with name (string, minLength 1), required (boolean), and defaultExpr (string or null); referenced by access-control rules.
Broadened additionalProperties types
wren-mdl/mdl.schema.json
For models[], relationships[], metrics[], views[], enumDefinitions[] and enumDefinitions.values[]: additionalProperties type widened from string to union ["string","number","boolean","object","array","null"].
Removed legacy features
wren-mdl/mdl.schema.json
Removed top-level/definitions blocks for macros, cumulativeMetrics, and dateSpine.
Documentation/descriptions
wren-mdl/mdl.schema.json
Various description strings marked WIP for multiple public definitions (refs, baseObject, cached/refreshTime, metrics, views, enums).

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant User
  participant Engine as Query Engine
  participant Schema as Model Schema
  participant Session as Session Props
  participant RowRules as Row ACLs
  participant ColRules as Column ACLs

  User->>Engine: Submit query
  Engine->>Schema: Load model, view, column definitions
  Engine->>Session: Resolve `$defs/sessionProperty` values (use `defaultExpr` if present)

  Engine->>RowRules: Evaluate `rowLevelAccessControls` (conditions using session props)
  alt row allowed
    Engine->>Schema: include rows
  else
    Engine->>Schema: exclude rows
  end

  Engine->>ColRules: For each column, check `isHidden` and `columnLevelAccessControl`
  alt column visible & ACL satisfied
    Engine->>User: include column in result
  else
    Engine->>User: omit column
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

I hop through schemas, twitch my ear,
New gates and rules now crystal clear.
Session carrots guide each rule and row,
Old burrows closed — the pathways grow.
A tiny thump — the model's bright, we go! 🐇✨

✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/mdl-spec-update

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore or @coderabbit ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@goldmedal goldmedal requested a review from wwwy3y3 September 3, 2025 08:30
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🧹 Nitpick comments (4)
wren-mdl/mdl.schema.json (4)

131-158: Root fields LGTM; minor nit: redundant minLength with enum

"minLength": 1 is unnecessary when enum is present.

   "dataSource": {
     "description": "the data source type",
     "type": "string",
     "enum": [
       "BIGQUERY",
@@
-    ],
-    "minLength": 1
+    ]
   },

89-95: Consider widening column.properties to match others

Column-level properties.additionalProperties still restricts to string, unlike models/relationships/etc.

 "properties": {
   "description": "the customize properties of the column",
   "type": "object",
   "additionalProperties": {
-    "type": "string"
+    "type": ["string", "number", "boolean", "object", "array", "null"]
   }
 }

206-207: Typos and terminology polish in user-facing descriptions

  • Line 206-207: “OEN_TO_MANY” → “ONE_TO_MANY”.
  • Line 339: “It’s should belong” → “It should belong”.
  • Lines 404, 172: Prefer “SQL” over “sql”.
  • Lines 242, 291, 409, 449, 460: “the customize properties” → “custom properties”.

I can prep a follow-up copy-edit PR if helpful.

Also applies to: 339-369, 404-407, 214-217


48-59: Optional: operator/dataType coherence

If operator includes numeric comparisons, consider constraining threshold.dataType accordingly or documenting behavior for STRING comparisons.

Also applies to: 78-85

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between a207202 and ca094d2.

📒 Files selected for processing (1)
  • wren-mdl/mdl.schema.json (9 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Analyze (go)
🔇 Additional comments (7)
wren-mdl/mdl.schema.json (7)

36-39: isHidden addition looks good

Clear, boolean, and optional. No concerns.


246-246: Broadened additionalProperties for models: good

The union type increases flexibility for custom props.


295-295: Broadened additionalProperties for relationships: good

Consistent with models; no issues.


384-384: Broadened additionalProperties for metrics: good

No concerns.


412-412: Broadened additionalProperties for views: good

No concerns.


452-452: Broadened additionalProperties for enum member properties: good

No concerns.


463-463: Broadened additionalProperties for enum definitions: good

No concerns.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
wren-mdl/mdl.schema.json (1)

212-214: Fix typo in user-facing description: OEN_TO_MANY → ONE_TO_MANY

This appears in docs and tooling; keep polished.

Apply:

-            "description": "the primary key of the model. It's required if the model is the one side of any OEN_TO_MANY or MANY_TO_ONE relationship",
+            "description": "the primary key of the model. It's required if the model is the one side of any ONE_TO_MANY or MANY_TO_ONE relationship",
🧹 Nitpick comments (3)
wren-mdl/mdl.schema.json (3)

93-99: Align column.properties value types with the rest (consistency)

Other sections permit string|number|boolean|object|array|null; columns still restrict to string only.

Apply:

         "properties": {
           "description": "the customize properties of the column",
           "type": "object",
           "additionalProperties": {
-            "type": "string"
+            "type": ["string", "number", "boolean", "object", "array", "null"]
           }
         }

104-123: Session property: default and naming clarity

  • Provide a default for required to reduce ambiguity at authoring time.
  • Optional: consider isRequired to avoid confusion with JSON Schema “required”.

Apply:

         "required": {
           "description": "whether the session property is required or not",
-          "type": "boolean"
+          "type": "boolean",
+          "default": false
         },

If you want to rename to isRequired, I can draft the full diff including references.


279-288: Optional: enforce distinct model names in relationships

You already constrain to exactly two entries; make them unique.

Apply:

           "models": {
             "description": "the list of models",
             "type": "array",
             "items": {
               "type": "string",
               "minLength": 1
             },
             "minItems": 2,
-            "maxItems": 2
+            "maxItems": 2,
+            "uniqueItems": true
           },
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 06f4077 and 05043ad.

📒 Files selected for processing (1)
  • wren-mdl/mdl.schema.json (10 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Analyze (go)
🔇 Additional comments (6)
wren-mdl/mdl.schema.json (6)

36-39: LGTM: isHidden fits the column contract

Boolean defaulting handled by consumers. No schema issues here.


137-164: LGTM: sampleDataFolder and dataSource

Enums look sane; minLength is redundant with enum but harmless.


303-304: LGTM: broadened property value types

The union matches other sections and improves extensibility.


311-389: LGTM: metrics section WIP markers and property unions

Constraints look coherent; timeGrain has solid enums.


421-422: LGTM: views.properties value type union

Consistent with models/relationships.


462-463: LGTM: enumDefinitions properties broadened

Allows richer annotations on enums and members.

Also applies to: 473-474

@goldmedal goldmedal requested a review from douenergy September 26, 2025 03:47
@douenergy douenergy merged commit 1142ce7 into main Sep 26, 2025
9 checks passed
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