Reference to location within data in SchemaError
See original GitHub issueI would like SchemaError to tell me where in the data structure the error occurred.
Something like:
# Schema:
Schema({
'key1': {
'child1': {
'child2': [
{'pedo': bool}
]
}
},
Optional('key2'): {
'foo': str
}
})
# Data:
{
'key1': {
'child1': {
'child2': [
{'pedo': 1},
{'pedo': false},
]
}
}
}
# Error message:
{
'key1': {
'child1': {
'child2': {
0: {'pedo': 'this value should be an instance of bool not int'}
}
}
}
}
# Or as a list:
['key1', 'child1', 'child2', 0, 'pedo']
This way I would be able to find the location of the error in my parsed YAML file. It’s also just a lot more helpful error message. Something like 1 should be bool
tells me almost nothing.
Issue Analytics
- State:
- Created 8 years ago
- Reactions:6
- Comments:5 (2 by maintainers)
Top Results From Across the Web
How can I fix "Can't resolve reference" error when referencing ...
2 Answers 2 · The reference is inside the same file. I can also read the documentation for ajv. But what is wrong...
Read more >Understanding schema errors | HESA
Schema errors are designed to give as much location information as possible but the amount of information displayed will depend on how far...
Read more >Schema error on slick_entityreference_vanilla formatter [#2997165 ...
Problem/Motivation The slick_entityreference_vanilla formatter doesn't have any schema. However, the module provides schema for a non-exisiting ...
Read more >Specifying a schema | BigQuery - Google Cloud
BigQuery lets you specify a table's schema when you load data into a table, and when you create an empty table. Alternatively, you...
Read more >Introduction to Schema: A Python Libary to Validate your Data
What if we want to determine whether the data within a column satisfies a specific condition that is not relevant to data types...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I agree. The current message is quite useless. Having a simple list with the path to the error would be super helpful.
looks like this may be handled recently by this: https://github.com/keleshev/schema/commit/61cc0bf84dd3efc830a366fb200c386bae35c243
Here’s the behavior on your example: