dbt-labs / dbt-labs/dbt-jsonschema

[Fusion] False positive validation error on inline dictionary syntax for freshness configuration

Open
#214 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
169
Forks
61
Avg merge
1m
Merged PRs (30d)
1

Description

## Bug Description

The `latest_fusion/dbt_project-latest-fusion.json` schema contains a `default` property in `FreshnessDefinition` that causes YAML validators to incorrectly reject valid integer and string values for `count` and `period`, only accepting `null` despite the schema explicitly allowing other types.

## Reproduction

**Schema configuration (.vscode/settings.json):**
```json
{
"yaml.schemas": {
"https://raw.githubusercontent.com/dbt-labs/dbt-jsonschema/main/schemas/latest_fusion/dbt_project-latest-fusion.json": [
"dbt_project.yml"
]
}
}
```

**dbt_project.yml (both inline AND multi-line formats fail):**
```yaml
models:
linkedin_ads:
staging:
linkedin_ads:
+freshness:
# Multi-line format - FAILS
warn_after:
count: 48 # Error: "Expected null"
period: hour # Error: "Expected null"
# Inline format - FAILS
error_after: {count: 96, period: hour} # Error: "Expected null"
```

**Validation errors:**
Line 229: Incorrect type. Expected "null". yaml-schema: Source configs
Line 231: Incorrect type. Expected "null". yaml-schema: Source configs`, lines 613-646):

```json
"warn_after": {
"default": {
"count": null,
"period": null
},
"anyOf": [
{
"$ref": "#/definitions/FreshnessRules"
},
{
"type": "null"
}
]
}
```

The `"default": {"count": null, "period": null}` causes the YAML validator to incorrectly interpret the schema as **only accepting null values**, even though `FreshnessRules` explicitly allows:

```json
"FreshnessRules": {
"type": "object",
"properties": {
"count": {
"type": ["integer", "null"], // ✅ Should accept integers!
"format": "int64"
},
"period": {
"anyOf": [
{
"$ref": "#/definitions/FreshnessPeriod" // ✅ Should accept "minute", "hour", "day"!
},
{
"type": "null"
}
]
}
}
}
```

## Expected Behavior

The schema should accept:
- `count`: Any positive integer (e.g., `24`, `48`, `9999`)
- `period`: One of `"minute"`, `"hour"`, or `"day"` (as defined in `FreshnessPeriod`)
- Both can also be `null`

## Actual Behavior

The validator **only accepts `null`** for both `count` and `period`, rejecting all valid non-null values.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.