question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Bug: Or on deeper structures breaks

See original GitHub issue

Hi, i found a bug when trying to “or” deeper nested structures:

from strictyaml import load, Map, MapPattern, Str, Int

yaml="""
configuration: 
  test1:
    helptext: "some text"
  test2:
    helptext: "some other text."
    min: 0
"""

schema = Map(
    {
        "configuration": MapPattern(
            Str(), 
            Map({
                "helptext": Str(), 
            }) | Map({
                "helptext": Str(), 
                "min": Int(), 
            }),
            minimum_keys=1
        ),
    }
)

data = load(yaml, schema=schema)
print(data.data)

which results in

strictyaml.exceptions.YAMLValidationError: when expecting an integer
found arbitrary text
  in "<unicode string>", line 5, column 1:
        helptext: some other text.
    ^ (line: 5)

the strange thing is, it “works” when themin validator is a Str() so i guess the validators are applied to the wrong content?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:14 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
crdoconnorcommented, Mar 31, 2019

Thanks. And thanks once again for pointing it out.

I’m working on preventing the above bug from occurring by preventing the combination of Maps / Seqs using the Or validator. I’ll put a message hinting that the end user should use revalidation for their purposes so future users won’t fall down the same rabbit hole.

0reactions
kumekaycommented, May 28, 2019

I have a small question, Though it’s not stated that project version is following semantic versioning, my general feeling says that patch version update shouldn’t introduce breaking changes. Do you have some policy about versioning for this project?

Read more comments on GitHub >

github_iconTop Results From Across the Web

What is a bug (computer bug)? - TechTarget
Software bugs have caused car crashes, explosions and other deadly accidents. ... In computer technology, a bug is a coding error in a...
Read more >
Insect morphology - Wikipedia
Insect morphology is the study and description of the physical form ; There is enormous variation in body structure amongst insect species. Individuals...
Read more >
Security bugs and flaws: Both bad, but in different ways
Security flaws are different from bugs, but they endanger the security of applications and systems just the same. Here's how to find and...
Read more >
Outshine breaks org-cycle with heading structure starting below ...
Hi, If outshine is just (require)d, org-cycle breaks with heading structures starting below level 1 (eg, a chapter before a part): Left shows...
Read more >
Brown Marmorated Stink Bug - Penn State Extension
The stink bug will not reproduce inside structures or cause damages. If many of them are crushed or sucked into a vacuum cleaner,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found