GithubHelp home page GithubHelp logo

Comments (6)

carlocorradini avatar carlocorradini commented on June 9, 2024 1

Same problem here!

Why this decision? 🙃

from ts-rs.

NyxCode avatar NyxCode commented on June 9, 2024 1

Agreed!
Let's keep track of changes, e.g in a CHANGELOG.md, so we can create a GitHub release with a migration guide on the next release.

from ts-rs.

escritorio-gustavo avatar escritorio-gustavo commented on June 9, 2024

Hey @NyxCode, is this intended behavior?

from ts-rs.

NyxCode avatar NyxCode commented on June 9, 2024

@escritorio-gustavo
I think it is, but it's a bit tricky!

My use-case are mostly HTTP APIs. There, I'd want "skip_serializing" to skip the field when my TS is receiving data, and "skip_deserializing" to skip the field if my TS is sending data.

One alternative I can see to the current behaviour (skip if "skip_serializing" or "skip_deserializing" is present) is to just ignore "skip_serializing" and "skip_deserializing" entirely. That's definetely a step forward, since you can then still skip the field with #[ts(skip)], but right now, there's no way to "un-skip" it.

There might be usecases where it'd be nice to get both variants - like in the REST API example above.

from ts-rs.

NyxCode avatar NyxCode commented on June 9, 2024

So I think the best way forward is to just ignore "skip_serializing" and "skip_deserializing" for now. Happy to be convinced of something else tho.

from ts-rs.

escritorio-gustavo avatar escritorio-gustavo commented on June 9, 2024

Yeah, the fact that the data can go both from TS to Rust and from Rust to TS makes this a lot more complicated.
As far as I can tell the only way around it is to ignore both attributes as you proposed and rely on #[ts(skip)] and #[serde(skip)], but that is probably a breaking change for a lot of people, so a major version bump is probably required to implement this

from ts-rs.

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.