Giter VIP home page Giter VIP logo

Comments (3)

Grokzen avatar Grokzen commented on July 21, 2024

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.

Grokzen avatar Grokzen commented on July 21, 2024

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.

Grokzen avatar Grokzen commented on July 21, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.