-
Notifications
You must be signed in to change notification settings - Fork 86
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
Pattern matching in a sequence? #13
Comments
Yes in a way it is possible to this but i think that you have to redefine your schema some. The idea here is not to have the pattern validation on the seq definition itself but on the data part of the sequence. The idea is that you define the key The next level is then the data inside the sequence and that is where i moved the regex check below. By having it there it makes perfect sense because you define the type of data that you want and that is a string and you then want a regex to match that data. I tried the following deploy_args:
allowed_address_pairs:
- 10.10.10.1012 type: map
mapping:
deploy_args:
required: true
type: map
mapping:
allowed_address_pairs:
type: seq
required: true
sequence:
- type: str
pattern: ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ And that fails with pattern validation error on the key in the data block thus proving that the pattern key works there. |
I do not know if this will help you visualize anything but this is a image from the original kwalify lib https://web.archive.org/web/20120222211120/http://www.kuwata-lab.com/kwalify/ruby/img/fig01.png |
Also i would really like it if you join the gitter chat if you have any further questions and avoid using the issue tracking for regular questions. The link to gitter can be found in the readme file and if you ping me with @Grokzen in there i get a notification email :] |
Is it not possible to check a pattern against a sequence?
The text was updated successfully, but these errors were encountered: