Skip to content Skip to footer
YAML: The Norway Problem (2022) by carlos-menezes

YAML: The Norway Problem (2022) by carlos-menezes

15 Comments

  • Post Author
    firesteelrain
    Posted April 12, 2025 at 11:54 pm

    This problem occurs because pyyaml load() uses the full YAML 1.1 schema. There is another function BaseLoader that will interpret everything as a string which is the workaround that the article suggests. Just another way to achieve it.

    It’s a bit of a sore spot in the YAML community as to why PyYAML can’t / won’t support YAML 1.2. It was in maintenance mode for a while. YAML 1.2 also introduced breaking changes.

    From a SO comment: “ As long as you're okay with the YAML 1.1 standard, PyYAML is still perfectly fine, secure, etc. If you want to support the YAML 1.2 spec (released in 2009), you can use ruamel.yaml, which started out as a fork of PyYAML. –
    CrazyChucky
    Commented Mar 26, 2023 at 20:51”

    https://stackoverflow.com/q/75850232

  • Post Author
    gnabgib
    Posted April 13, 2025 at 12:02 am

    Related

    The YAML document from hell (566 points, 2023, 353 comments) https://news.ycombinator.com/item?id=34351503

    That's a Lot of YAML (429 points, 2023, 478 comments) https://news.ycombinator.com/item?id=37687060

    No YAML (Same as above) (152 points, 2021, 149 comments) https://news.ycombinator.com/item?id=29019361

  • Post Author
    codr7
    Posted April 13, 2025 at 12:36 am

    [flagged]

  • Post Author
    dissent
    Posted April 13, 2025 at 12:51 am

    I reckon if this is really a big concern for anybody, then they are probably writing way too much YAML to begin with. If you're being caught out by things like this and need to debug it, then it maps very cleanly to types in most high level languages and you can generate your YAML from that instead.

  • Post Author
    ashishb
    Posted April 13, 2025 at 1:09 am

    How often do people even encounter this issue?
    I have been using YAML for 5+ years and have never had it before.
    Further, I use `yamllint` which points this out as a lint issue "truthy value should be one of [false, true]".

  • Post Author
    thyrsus
    Posted April 13, 2025 at 1:28 am

    I do a lot of ansible which needs to run on multiple versions, and their yaml typing are not consistent – whenever I have a variable in a logic statement, I nearly always need to apply the "| bool" filter.

  • Post Author
    quechimba
    Posted April 13, 2025 at 1:37 am

    We had this issue many years ago when people from Norway couldn't sign up. Took us a while to figure out

  • Post Author
    singpolyma3
    Posted April 13, 2025 at 2:05 am

    Quote your strings

  • Post Author
    umanwizard
    Posted April 13, 2025 at 2:50 am

    “Be liberal in what you accept” rears its ugly head once more.

  • Post Author
    kazinator
    Posted April 13, 2025 at 3:47 am

    In Lisp, if you want to read text into symbols (e.g. file of words), you just switch to a dedicated package in which those symbols are interned. Then if NIL happens to come up, it will be a symbol named "NIL" in that package, unrelated to the special object.

  • Post Author
    TZubiri
    Posted April 13, 2025 at 4:21 am

    That edge case sounds like a reasonable tradeoff you would make for such a simple and readable generic data format.

    Escaped json probably hits that sweetspot by being a bit uglier than yaml, but 100 times simpler than xml, though.

  • Post Author
    thund
    Posted April 13, 2025 at 4:25 am

    I like using tags and avoid any doubt

    !!boolean

    https://dev.to/kalkwst/a-gentle-introduction-to-the-yaml-for…

  • Post Author
    nnurmanov
    Posted April 13, 2025 at 4:48 am

    Another solution is to change the country name:)

  • Post Author
    riffraff
    Posted April 13, 2025 at 4:55 am

    Usual reminder that this is not a problem in YAML 1.2 released 15 years ago.

    Sadly many libraries still don't support it.

  • Post Author
    normie3000
    Posted April 13, 2025 at 4:55 am

    Google App Engine used to do this to environment variables defined in YAML. IIRC it would convert the string "true" to "Yes", which was a fun surprise when deploying Java And NodeJS apps.

Leave a comment

In the Shadows of Innovation”

© 2025 HackTech.info. All Rights Reserved.

Sign Up to Our Newsletter

Be the first to know the latest updates

Whoops, you're not connected to Mailchimp. You need to enter a valid Mailchimp API key.