Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dialyzer errors with if/then #85

Open
timothyvanderaerden opened this issue Nov 19, 2024 · 0 comments
Open

Dialyzer errors with if/then #85

timothyvanderaerden opened this issue Nov 19, 2024 · 0 comments

Comments

@timothyvanderaerden
Copy link

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant