Comments (3)
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 allowed_address_pairs
and then you define the data that should be in that key. And in this case that should be a sequence and you set it as required but it would make no sense to define a pattern there because you can't define a pattern for the sequence itself. How would you define a regex pattern that matches on a list defenition (not the data that it contains).
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.
from pykwalify.
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
from pykwalify.
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 :]
from pykwalify.
Related Issues (20)
- Union of schemas HOT 4
- rule.py is missing a comma in defined_keywords list
- Deprecation warning due to invalid escape sequences in Python 3.8 HOT 1
- Fails to regex match a mapping with integer keys HOT 1
- AttributeError: 'int' object has no attribute 'startswith'
- Support multiple data type HOT 1
- New release? Maintainers needed or? HOT 2
- Deprecation warning "the imp module is deprecated in favour of importlib" HOT 1
- pattern rule not working with all scalar types HOT 1
- <RuleError: error code 4
- Using fulmatch for regex matching. HOT 1
- Schema Validation Against Multiple Files HOT 1
- Outputting Scan Results in SARIF Format HOT 1
- How can I check key only? HOT 5
- anchors to inherit properties are falsely reported as Duplicate HOT 2
- ReadTheDocs does not seem to be updating
- Some error message for length violations are wrong
- issue while using "unique: true" for the sequence data type HOT 3
- Tests fail with ruamel.yaml 0.18.0
- Core Validation Fails - Multi Threading & Python 3.11 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pykwalify.