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 Feb 27, 2024
1 parent ee33f14 commit 1741038
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,19 @@
],
"type": "object"
},
"metric_config_schema": {
"$id": "metric_config_schema",
"additionalProperties": false,
"properties": {
"meta": {
"propertyNames": {
"type": "string"
},
"type": "object"
}
},
"type": "object"
},
"metric_input_measure_schema": {
"$id": "metric_input_measure_schema",
"oneOf": [
Expand Down Expand Up @@ -383,6 +396,9 @@
"$id": "metric_schema",
"additionalProperties": false,
"properties": {
"config": {
"$ref": "#/definitions/metric_config_schema"
},
"description": {
"type": "string"
},
Expand Down Expand Up @@ -578,6 +594,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 +622,9 @@
"$id": "semantic_model_schema",
"additionalProperties": false,
"properties": {
"config": {
"$ref": "#/definitions/semantic_model_config_schema"
},
"defaults": {
"$ref": "#/definitions/semantic_model_defaults_schema"
},
Expand Down
22 changes: 22 additions & 0 deletions dbt_semantic_interfaces/parsing/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,15 @@
"required": ["name", "type"],
}

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

# Top level object schemas
metric_schema = {
"$id": "metric_schema",
Expand All @@ -266,6 +275,7 @@
"filter": {"$ref": "filter_schema"},
"description": {"type": "string"},
"label": {"type": "string"},
"config": {"$ref": "metric_config_schema"},
},
"additionalProperties": False,
"required": ["name", "type", "type_params"],
Expand Down Expand Up @@ -378,6 +388,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 +415,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 +448,8 @@
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,
metric_config_schema["$id"]: metric_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 1741038

Please sign in to comment.