dbt-core: [CT-3316] [Bug] Invalid JSON schema for manifest v11
Is this a new bug in dbt-core?
- I believe this is a new bug in dbt-core
- I have searched the existing issues, and I could not find an existing issue for this bug
Current Behavior
Manifest v11 JSON schema has been released with dbt 1.7.0. However, it’s not a valid JSON schema:
{
"$ref": "#/$defs/WritableManifest",
"$defs": {
"ManifestMetadata": {
"type": "object",
"title": "ManifestMetadata",
...
}
}
Seems like $defs.ManifestMetadata contains the actual JSON schema that’s supposed to be published.
Expected Behavior
A valid JSON schema to be published.
Steps To Reproduce
- Copy https://schemas.getdbt.com/dbt/manifest/v11.json
- Paste it into a JSON schema validator, e.g. https://www.jsonschemavalidator.net/
Relevant log output
No response
Environment
- OS:
- Python:
- dbt:
Which database adapter are you using with dbt?
No response
Additional Context
No response
About this issue
- Original URL
- State: closed
- Created 8 months ago
- Comments: 15 (8 by maintainers)
@mars-lan thank you for surfacing this and thank you to Metaphor Data for sponsoring Coalesce! I hope the conference went well for you all. Wanted to update you and let you know that engineers are looking into this and will update shortly.
Just wanted to break in and say that https://www.jsonschemavalidator.net/ doesn’t support JSON Schema 2020-12 and seems not to be the best validator. The v11.json schema looks good in the eyes of these validators:
All of them support 2022-12 dialect and are listed on the official list of the online JSON Schema validators: https://json-schema.org/implementations#web-(online).
Also I’d like to note that using “$ref” and “$defs” keywords together is valid, as can be seen from this example:
The latest published v11 is working. I haven’t tested v12 yet, and doesn’t seem like there’s one published either: https://schemas.getdbt.com/dbt/manifest/v12/index.html
Confirmed that the latest JSON schema is passing. Feel free to close this now.
I synced with @dbeatty10. Although the v11.json manifest artifact can be used to produce models with the datamodel-code-generator. What is currently broken is using the artifact as custom schema to validate input json (which it used to do). In my demo, I put the schema in the right hand box on https://www.jsonschemavalidator.net/ which verified that it was valid jsonschema. What doesn’t work is putting it in the left hand box of https://www.jsonschemavalidator.net/ to show that it can be used as a custom schema to validate json.
@QMalcolm I was able to reproduce with catalog/v1.json. The original poster reported issues with the schema for
manifest.json, but I had a smallcatalog.jsonhandy, and it exhibits the same underlying issue with https://www.jsonschemavalidator.net/.Reprex
But if you replace the Select schema with the contents from here, it should validate:
@mars-lan I am currently working on this
We used https://github.com/koxudaxi/datamodel-code-generator to generate Python classes from the JSON schema and it also had issues parsing the schema.