Giter VIP home page Giter VIP logo

Comments (2)

Grokzen avatar Grokzen commented on July 21, 2024

@jcfr Hi. First i must say you compiled a very good and easy to use example. The thing is that i do not think that it is broken becuase i think that you hade defined your fail example wrong.

If the case is that you want to extract the part you have in your partial from the first OK schema, the thing i see in that case is how you define your include.

You currently have the following yaml file in your failing test

type: map
mapping:
  - foo:   <--- Difference here
      type: seq
      sequence:
        - type: str

where the difference between your OK schema and this is that virtually the schema will look like that because when pykwlaify processes include directives it do not remove the previous list item that it is contained in. Think of the include statement as exaclty here i will inject this partial schema and in your case it would virtually look like above.

To solve this i just changed one line in your example code

type: map
mapping:
  foo:
    include: list_str  <--- Removed list here

and the script passes through without any error and validation errors.

Another thing is that pykwalify should consider the schema you posted above as invalid in a way but the validation part i guess is missing for where exactly include statements is possible and not. I do think that it should be possible to have a include where you have set it right now but the problem is then in what it includes and how it validates. You could argue based on this that it should not prompt a AttributeError exception but possible a validation error of some kind but i am not really sure to be honest.

One of the problems of parsing partial schemas is that when they are processes at runtime the schema is not processed and all includes is replaced with the partials to build one big coherent schema file that can be validated and syntax checked becuase there was edge cases with infinite recursion depth problems and some other minor reasons that required lazy evaluation.

If my suggestion above is correct and valid then please go ahead and close this issue.

from pykwalify.

Grokzen avatar Grokzen commented on July 21, 2024

@jcfr I will close this issue as resolved based on my previous comment above and the suggested fix there.

If you find any related bugs to partial schemas please open a new issue.

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.