Exonerate
Exonerate copied to clipboard
Dialyzer errors with if/then
I have a schema with a required value based on the value of an enum, the schema looks likt the following:
"type": "object",
"required": [
"a"
],
"additionalProperties": false,
"properties": {
"a": {
"type": "string",
"enum": [
"one",
"two"
]
},
"b": {
"type": "string"
}
},
"allOf": [
{
"if": {
"properties": {
"a": {
"const": "one"
}
}
},
"then": {
"required": [
"b"
]
}
}
]
Dialyzer will output the following error:
lib/json_schema.ex:44:pattern_match_cov
The pattern
_, _
can never match, because previous clauses completely cover the type
map(), <<_::8>>.
________________________________________________________________________________
lib/json_schema.ex:57:guard_fail
The guard test:
is_boolean(_ :: map())
can never succeed.
________________________________________________________________________________
lib/json_schema.ex:57:guard_fail
The guard test:
is_float(_ :: map())
can never succeed.
________________________________________________________________________________
lib/json_schema.ex:57:guard_fail
The guard test:
is_integer(_ :: map())
can never succeed.
________________________________________________________________________________
lib/json_schema.ex:57:guard_fail
The guard test:
is_list(_ :: map())
can never succeed.
________________________________________________________________________________
lib/json_schema.ex:57:guard_fail
The guard clause:
when _ :: map() == nil
can never succeed.
________________________________________________________________________________
done (warnings were emitted)
Halting VM with exit status 2