Skip to content

Commit

Permalink
jsonschema updates for meta field
Browse files Browse the repository at this point in the history
  • Loading branch information
WilliamDee committed Jan 20, 2024
1 parent 1b9bc27 commit bc18150
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,12 @@
"label": {
"type": "string"
},
"meta": {
"propertyNames": {
"type": "string"
},
"type": "object"
},
"name": {
"pattern": "(?!.*__).*^[a-z][a-z0-9_]*[a-z0-9]$",
"type": "string"
Expand Down Expand Up @@ -578,6 +584,19 @@
],
"type": "object"
},
"semantic_model_config_schema": {
"$id": "semantic_model_config_schema",
"additionalProperties": false,
"properties": {
"meta": {
"propertyNames": {
"type": "string"
},
"type": "object"
}
},
"type": "object"
},
"semantic_model_defaults_schema": {
"$id": "semantic_model_defaults_schema",
"additionalProperties": false,
Expand All @@ -593,6 +612,9 @@
"$id": "semantic_model_schema",
"additionalProperties": false,
"properties": {
"config": {
"$ref": "#/definitions/semantic_model_config_schema"
},
"defaults": {
"$ref": "#/definitions/semantic_model_defaults_schema"
},
Expand Down
12 changes: 12 additions & 0 deletions dbt_semantic_interfaces/parsing/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,7 @@
"filter": {"$ref": "filter_schema"},
"description": {"type": "string"},
"label": {"type": "string"},
"meta": {"type": "object", "propertyNames": {"type": "string"}},
},
"additionalProperties": False,
"required": ["name", "type", "type_params"],
Expand Down Expand Up @@ -378,6 +379,15 @@
"additionalProperties": False,
}

semantic_model_config_schema = {
"$id": "semantic_model_config_schema",
"type": "object",
"properties": {
"meta": {"type": "object", "propertyNames": {"type": "string"}},
},
"additionalProperties": False,
}

semantic_model_schema = {
"$id": "semantic_model_schema",
"type": "object",
Expand All @@ -396,6 +406,7 @@
"dimensions": {"type": "array", "items": {"$ref": "dimension_schema"}},
"description": {"type": "string"},
"label": {"type": "string"},
"config": {"$ref": "semantic_model_config_schema"},
},
"additionalProperties": False,
"required": ["name"],
Expand Down Expand Up @@ -428,6 +439,7 @@
export_schema["$id"]: export_schema,
export_config_schema["$id"]: export_config_schema,
saved_query_query_params_schema["$id"]: saved_query_query_params_schema,
semantic_model_config_schema["$id"]: semantic_model_config_schema,
}

resources: List[Tuple[str, Resource]] = [(str(k), DRAFT7.create_resource(v)) for k, v in schema_store.items()]
Expand Down

0 comments on commit bc18150

Please sign in to comment.