dbt-labs / dbt-labs/metricflow

Validation error message on ratio metrics is confusing

Open
#64 1 comment 1 reaction 1 assignee Claimed by @QMalcolm View on GitHub
bug
Dominant language
Python
Stars
1.8k
Forks
202
Avg merge
1d 8h
Merged PRs (30d)
14

Description

**Describe the bug**
If someone puts in the "measures" property in the type_params for a ratio metric they get a generic "additional properties are not allowed" message, which makes it very difficult to detect the issue since "measures" is a valid property in some cases (such as with expr metrics).

See https://metricflow.slack.com/archives/C0386PW7R98/p1651761752427959 for a real-world example.

**Steps To Reproduce**
Steps to reproduce the behavior:

1. Add a ratio metric to the config
2. Include numerator, denominator, and measures in the type params
3. Run the validation

**Expected behavior**
I'd expect the error message to reference the ratio metric type, at the very least. Ideally we'd be able to say which metric was incorrectly defined. This is harder to do when the issue is in the base YAML parser/PyDantic object initializer (as it is in this case - the error is coming from the JSONSchema validation layer) but it's worth exploring.

**Environment (please complete the following information):**

- MetricFlow Version [0.93.0]

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.