Giter VIP home page Giter VIP logo

Comments (2)

partim avatar partim commented on June 3, 2024

Thank you for the report!

There’s actually two issues here.

The error you get is from the sequence deserializer expecting a borrowed string for each item – which serde_json doesn’t provide.

The gratuitous escaping stems from serializing the content of the character strings in unquoted representation format which does require white space to be escaped. That is probably unnecessary and we can instead use a simplified serialization that only escapes non-printable characters and the backslash.

Since I am currently cleaning up TXT anyway, I’ll fix both of the issues as part of the 0.10.0 release.

from domain.

partim avatar partim commented on June 3, 2024

So this is all a wee bit annoying.

For human readable serialization formats, the TXT record data should canonically serialize as a sequence of character strings – because that is what it is. However, for deserializing, it should also accept a single string, because that is very likely what people will provide (like in the example above). Unfortunately, serde_json doesn’t follow the serde documentation and treats the type hints as absolute truth, meaning that it will reject the string if I hint at the type being a sequence. You can use deserialize_any, but that means the deserializing will not work from formats that don’t have embedded type information.

I think the right thing to do is still to use the hint at a sequence and also implement deserializing from a string, even if that means JSON deserialization from a string won’t actually work.

from domain.

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.