Closed james-bellamy closed 2 years ago
Oups, seems it's another incarnation of https://github.com/for-GET/jesse/pull/113.
It's unfortunate that we support too many representations of JSON objects internally… Maybe should migrate to some common internal format eventually instead of calling unwrap
on-spot...
I'll try to have a look. Or would appreciate a PR. Theproblem is that here: https://github.com/for-GET/jesse/blob/83281a59ae3cd9b0cd1c161535bc0105f3048fe1/src/jesse_state.erl#L185-L189
we assume "if it is no a map, then it is for sure a list", but in fact it can be {[ {K, V} ]}
or {struct, [{K, V}]}
or whatever JSON object
representation we support https://github.com/for-GET/jesse/blob/83281a59ae3cd9b0cd1c161535bc0105f3048fe1/src/jesse_json_path.erl#L127-L134
As a workaround you may try to use map()
representation for your JSON schema (eg, return_maps
option in Jiffy or JSX)
Hello, we're running into the following error:
function_clause in function lists:keydelete3/3 (lists.erl, line 690) called as keydelete3(<<"$ref">>,1,{[{<<"$ref">>,<<"file://offer.json">>}]}) in call from jesse_state:set_current_schema/2 (jesse/src/jesse_state.erl, line 189) in call from jesse_validator_draft3:check_items/3 (jesse/src/jesse_validator_draft3.erl, line 531) in call from jesse_validator_draft3:check_value/3 (jesse/src/jesse_validator_draft3.erl, line 105) in call from jesse_validator_draft3:check_value/4 (jesse/src/jesse_validator_draft3.erl, line 228) in call from lists:foldl/3 (lists.erl, line 1263) in call from jesse_validator_draft3:check_properties/3 (jesse/src/jesse_validator_draft3.erl, line 348) in call from jesse_validator_draft3:check_value/3 (jesse/src/jesse_validator_draft3.erl, line 72)
Pinning to https://github.com/for-GET/jesse/commit/388cfa6cb55e148d021e96cc5bdfb944c0e3e292 resolves the problem. In the schemas the line
file://offer.json
appears as"id": "file://offer.json",
within the offer.json file and"items": { "$ref": "file://offer.json" },
with another file.Is the problem with our usage or is there a bug in jesse?