Skip to content

Changing match_pattern can break predefined validators #7

@piotrp

Description

@piotrp

While looking at docs I noticed that I can pass a custom match_pattern implementation, but I also see that there are a few validations (eg. email, IPv4) that depend on it being PCRE-compatible.

Also, docs describe this parameter as:

function called to match patterns, defaults to string.find.

while the code tries hard to use PCRE:

https://github.com/iresty/jsonschema/blob/f0a20ad7a64f90360a357c72e17bc1574be60ee6/lib/jsonschema.lua#L43-L52

string.find is used only as a last resort, but then validators that depend on PCRE (eg. email, IPv4) will break.

It's not a problem for me, just reporting what I found.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions