Skip to content

pattern should only be applicable to the string type, and no other types #242

@Relequestual

Description

@Relequestual

There's a Stackoverflow question that asks how you can validate the number of digits in a number using JSON Schema: https://stackoverflow.com/questions/53449740/how-can-i-validate-number-of-digits-in-a-number-using-json-schema-ajv/53449981

I explained, you cannot currently do this. Someone suggested you could use pattern, however it is only applicable to strings and not other types.

We have a test for checking pattern isn't applied to a bool, but no test to check that it isn't applied to a number.

There should be a test for checking that pattern isn't incorrectly applied to all other types. Some languages will stringify numbers.

Metadata

Metadata

Assignees

No one assigned

    Labels

    good first issueAn issue that is a good candidate for new contributorsmissing testA request to add a test to the suite that is currently not covered elsewhere.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions