diff --git a/dbt_semantic_interfaces/parsing/generated_json_schemas/default_explicit_schema.json b/dbt_semantic_interfaces/parsing/generated_json_schemas/default_explicit_schema.json index 7384be5f..61bb8f3b 100644 --- a/dbt_semantic_interfaces/parsing/generated_json_schemas/default_explicit_schema.json +++ b/dbt_semantic_interfaces/parsing/generated_json_schemas/default_explicit_schema.json @@ -17,6 +17,38 @@ }, "type": "object" }, + "conversion_type_params_schema": { + "$id": "conversion_type_params_schema", + "additionalProperties": false, + "properties": { + "base_measure": { + "$ref": "#/definitions/metric_input_measure_schema" + }, + "calculation": { + "enum": [ + "CONVERSIONS", + "CONVERSION_RATE", + "conversions", + "conversion_rate" + ] + }, + "conversion_measure": { + "$ref": "#/definitions/metric_input_measure_schema" + }, + "entity": { + "type": "string" + }, + "window": { + "type": "string" + } + }, + "required": [ + "base_measure", + "conversion_measure", + "entity" + ], + "type": "object" + }, "dimension_schema": { "$id": "dimension_schema", "additionalProperties": false, @@ -347,10 +379,12 @@ "RATIO", "CUMULATIVE", "DERIVED", + "CONVERSION", "simple", "ratio", "cumulative", - "derived" + "derived", + "conversion" ] }, "type_params": { @@ -368,6 +402,9 @@ "$id": "metric_type_params", "additionalProperties": false, "properties": { + "conversion_type_params": { + "$ref": "#/definitions/conversion_type_params_schema" + }, "denominator": { "$ref": "#/definitions/metric_input_measure_schema" }, diff --git a/dbt_semantic_interfaces/parsing/schemas.py b/dbt_semantic_interfaces/parsing/schemas.py index aafdc4b4..cad88081 100644 --- a/dbt_semantic_interfaces/parsing/schemas.py +++ b/dbt_semantic_interfaces/parsing/schemas.py @@ -9,9 +9,12 @@ # Enums -metric_types_enum_values = ["SIMPLE", "RATIO", "CUMULATIVE", "DERIVED"] +metric_types_enum_values = ["SIMPLE", "RATIO", "CUMULATIVE", "DERIVED", "CONVERSION"] metric_types_enum_values += [x.lower() for x in metric_types_enum_values] +calculation_types_enum_values = ["CONVERSIONS", "CONVERSION_RATE"] +calculation_types_enum_values += [x.lower() for x in calculation_types_enum_values] + entity_type_enum_values = ["PRIMARY", "UNIQUE", "FOREIGN", "NATURAL"] entity_type_enum_values += [x.lower() for x in entity_type_enum_values] @@ -85,6 +88,20 @@ "additionalProperties": False, } +conversion_type_params_schema = { + "$id": "conversion_type_params_schema", + "type": "object", + "properties": { + "base_measure": {"$ref": "metric_input_measure_schema"}, + "conversion_measure": {"$ref": "metric_input_measure_schema"}, + "calculation": {"enum": calculation_types_enum_values}, + "entity": {"type": "string"}, + "window": {"type": "string"}, + }, + "additionalProperties": False, + "required": ["base_measure", "conversion_measure", "entity"], +} + metric_type_params_schema = { "$id": "metric_type_params", "type": "object", @@ -99,6 +116,7 @@ "type": "array", "items": {"$ref": "metric_input_schema"}, }, + "conversion_type_params": {"$ref": "conversion_type_params_schema"}, }, "additionalProperties": False, } @@ -382,6 +400,7 @@ filter_schema["$id"]: filter_schema, metric_input_measure_schema["$id"]: metric_input_measure_schema, metric_type_params_schema["$id"]: metric_type_params_schema, + conversion_type_params_schema["$id"]: conversion_type_params_schema, entity_schema["$id"]: entity_schema, measure_schema["$id"]: measure_schema, dimension_schema["$id"]: dimension_schema,