-
Notifications
You must be signed in to change notification settings - Fork 103
Description
Before opening, please confirm:
- I have searched for duplicate or closed issues.
- I have read the guide for submitting bug reports.
- I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.
Bug Category
Schemas and Validation
Describe the bug
For the below schema, the reported error is
unknown field `baz`, expected one of `type`, `element`, `attributes`, `additionalAttributes`, `name`
This is misleading because baz
is a completely valid field (attribute name), and changing baz
to some other string (like the ones listed) will not fix the problem.
Instead, the issue is in the bar
field. The set element type was listed as "Long"
instead of { "type": "Long" }
.
If you fix the set-element mistake, you see that a similar mistake was made in the baz
field, but that one actually has a reasonable-ish error message once you fix the set-element mistake:
invalid type: string "Boolean", expected struct TypeOfAttribute
This actually points to the correct problem location ("Boolean"
), and from this error message an end-user could probably decipher a hint that they need a JSON object instead of just the string "Boolean"
. (This error message itself could definitely be improved, too; for instance, we could suggest that you need { "type": ... }
instead of using the cryptic term TypeOfAttribute
; and we could even perhaps suggest { "type": "Boolean" }
in this particular case.)
Expected behavior
A better error message -- at least one that points to the bar
attribute instead of baz
, and ideally a reasonable suggested fix. See above.
Reproduction steps
Try to parse the schema given below
Code Snippet
{ "": {
"entityTypes": {
"a": {
"shape": {
"type": "Record",
"attributes": {
"foo": { "type": "Entity", "name": "b" },
"bar": { "type": "Set", "element": "Long" },
"baz": { "type": "Record", "attributes": { "z": "Boolean" } }
}
}
},
"b": {}
}
} }
Log output
No response
Additional configuration
No response
Operating System
No response
Additional information and screenshots
No response