Coder Social home page Coder Social logo

Comments (2)

EdwardCooke avatar EdwardCooke commented on June 11, 2024

Ok, so I finally got some time to look at this. It isn't that it's interpreting it as an empty string, but rather an empty scalar object. This is by design and changing the way it's handled and converting it to a null would be a breaking change that could easily cause a lot of problems for anybody using this.

What it does is reads the yaml node explicitly. Setting the scalar object with an empty string and no tag, since one doesn't exist on that node and marks it as a plain formatted scalar (as opposed to a single, double quoted, etc). Then, when it serializes it, since there is no tag, it writes out a quoted empty string. If there is a tag, like !!null it works as expected, which also outputs the tag in the object, which is not ideal since it doesn't round trip the YAML the way that would be expected.

I have some code ready for it, just want to run some additional tests and validate it a little more to make sure it's most likely not going to inadvertently break some consumer of the library.

from yamldotnet.

EdwardCooke avatar EdwardCooke commented on June 11, 2024

I have a PR ready with good tests around it to make sure it won't break existing users (in theory). I am going to give the current version another week before putting out a new one.

from yamldotnet.

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.