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

Schema validator dont check regular expression #243

Open
sginer opened this issue Oct 24, 2017 · 1 comment
Open

Schema validator dont check regular expression #243

sginer opened this issue Oct 24, 2017 · 1 comment

Comments

@sginer
Copy link

sginer commented Oct 24, 2017

Property with regexp pattern dosn not work fine. For example, this schema

{
	"$schema": "http://json-schema.org/draft-04/schema#",
	"type": "object",
	"properties": {
		"id": {
			"type": "string",
			"pattern": "[A-Za-z0-9\\-\\.]{1,64}"
		}
	}
}

validate this invalid json

{
	"id" : "re@"
}

but dont validate this

{
	"id" : "@"
}
@blag001
Copy link

blag001 commented Mar 1, 2018

Not a bug.
Your REGEX is not what you think:

https://regex101.com/r/KcJKh9/1

You're after a ^[A-Za-z0-9.-]{1,64}$:
https://regex101.com/r/APgsZP/2

Regards,
Blag

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

2 participants