Git Product home page Git Product logo

Comments (9)

timostamm avatar timostamm commented on June 15, 2024 1

There certainly are some situations where this would be handy.

This could be a separate client style, or maybe an option on the method level:

rpc Example (RequestMessage) returns (ResponseMessage) {
    option (ts.accept_partial) = true;
};

Main focus is releasing 2.0. It adds client styles and other features and has to become stable and could even need some simplification before this feature can be added on top.

In the meantime, there is always create():

// make a hat
let call = await client.makeHat( Size.create({ inches: 23 }) );

from protobuf-ts.

timostamm avatar timostamm commented on June 15, 2024 1

After pondering this for a while, I think partial request inputs should simply be the default behavior.

It adds a bit of a penalty because we will have to do a partial merge on the input, even if the input is complete. But convenience seems more important.

from protobuf-ts.

jcready avatar jcready commented on June 15, 2024 1

No worries! Thank you again for this wonderful project! It's head and shoulders above anything else currently available.

from protobuf-ts.

timostamm avatar timostamm commented on June 15, 2024 1

Denis, are you sure you want to stringify the message directly? Why not use the canonical JSON encoding instead. Response.toJsonString(response, {prettySpaces: 2}).

from protobuf-ts.

timostamm avatar timostamm commented on June 15, 2024

Reminder for the implementation: Creating a message from a partial instance discards unknown fields. It must still be possible (and should be the default) to keep unknown fields in a rpc round trip.

from protobuf-ts.

timostamm avatar timostamm commented on June 15, 2024

This won't make it into 2.0 😞 The API change is non-breaking, so it should be good to add in a minor release.

from protobuf-ts.

someden avatar someden commented on June 15, 2024

That is something that will useful for my case, because I need to render rpc response as is.
Like <code>{JSON.stringify(response, null, 2)}</code>.
And without proto3 optionals there is a lot of useless fields with empty strings.
So, any updates?

from protobuf-ts.

someden avatar someden commented on June 15, 2024

Didn't know that) Problem solved, perfect, thanks!

from protobuf-ts.

ehiggins98 avatar ehiggins98 commented on June 15, 2024

What's the status on this request? We'd like to migrate our frontend to protobuf-ts, but we have a large number of protos that don't use optional and it's not feasible to update them

from protobuf-ts.

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.