Git Product home page Git Product logo

Comments (3)

crdoconnor avatar crdoconnor commented on August 10, 2024

IndexError: string index out of range (in strictyaml/utils.py L96)

This exception should definitely never be happening, thanks for reporting it. I've got a fix ready to roll out in the next release. That one should work seamlessly now.

As suggested in the first error message above the following works, but it describes a different schema (namely, it allows an existing, empty a)!

Can you explain what the issue you have with this is? As far as I can see it just allows two different ways of representing the same valid data - one implicit (optional; no key) and one explicit (key, with blank string). This was by design: optional default is supposed to be a default - not a value that isn't representable if the key is present.

I use something like this (EmptyList() | Seq()) quite a lot, actually - and if, like me, you want "empty list" to be a valid value for a... allowing an empty "a" makes sense, no?

I'm open to the idea of disallowing the blank string representation, but I'd like to hear a coherent justification why - i.e. realistic examples/use cases.

I'm also looking at a related issue #62 - so any input on that would be welcome, too. Two people having a similar kind of issue makes me wonder if there's something I'm missing.

from strictyaml.

klmr avatar klmr commented on August 10, 2024

optional default is supposed to be a default - not a value that isn't representable if the key is present.

That makes sense. Since EmptyList() | … is what I’m currently using as a “workaround” I guess there’s no harm sticking with it. 👍

from strictyaml.

klmr avatar klmr commented on August 10, 2024

By the way, I did see #62 but that’s unrelated.

from strictyaml.

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.