Comments (2)
@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.
@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)
- Deprecate imp module HOT 1
- type: int has a limit in python 2.7 HOT 1
- 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
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.