Skip to content

Why not coerce string 1 and 0? #395

@shmax

Description

@shmax

Hi folks, I just have a question for you. I'm a contributor to a similar project as this one, written in PHP. We've recently added support for type coercion, and a few days ago someone submitted a PR with the aim of supporting coercion of string "1" and "0" to boolean.

jsonrainbow/json-schema#345

I've been arguing against it, but with a flawed rationale (I was unaware that http_build_query converts true and false to string 1 and 0).

I've studied your coercion grid carefully, and if I understand correctly you do NOT coerce string 1 and 0 to boolean. I was wondering if you could explain your reasoning? Thanks much!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions