Comments (4)
Hi @bhollis ; well I put up #1043 , lets see if you're right 🤞 :-)
from ts-proto.
Okay, @bhollis I did the basic minimum of bumping ts-proto-descriptors--is that going to do what you want? I'm slightly curious if we should have turned on a proto2-specific build option, but I'm not sure. Thanks!
from ts-proto.
🎉 This issue has been resolved in version 1.176.0 🎉
The release is available on:
Your semantic-release bot 📦🚀
from ts-proto.
Thanks for doing that! Unfortunately I was wrong - it wasn't as simple as just releasing the newest version. Even when removing disableProto2Optionals
, fields still aren't set when they are at their default value. Here's the change when removing disableProto2Optionals
:
toJSON(message: EnumValueDescriptorProto): unknown {
const obj: any = {};
- if (message.name !== "") {
+ if (message.name !== undefined && message.name !== "") {
obj.name = message.name;
}
- if (message.number !== 0) {
+ if (message.number !== undefined && message.number !== 0) {
obj.number = Math.round(message.number);
}
if (message.options !== undefined) {
You can see that the optional fields aren't set when the value is not undefined, when I think they should be.
I can switch over to protobuf-es
for this task, so this isn't urgent, but I really prefer ts-proto
's approach to generated code in general. This is my first time having to deal with proto2 semantics.
Thanks for the project! If I get some free time I might try to file a PR to fix this, though I have some other things I'd probably want to try first.
from ts-proto.
Related Issues (20)
- TypeError on Runtime ChannelCredentials object HOT 1
- Using 'useDate=string' parameter; the response is still anticipating an object for Timestamp Wrapper
- Encode crashes on `null` object values HOT 2
- Rpc doesn't account for metadata HOT 2
- Rpc is not exported by ts-proto as it previously was HOT 6
- Generated affixes HOT 5
- Conflicting protobuf definitions when using ts-proto plugin with Buf HOT 2
- Support for proto-loader "virtual" oneof field
- Proto import statements not being recognized HOT 1
- Support for messages with the same name as an rpc method HOT 2
- unexpected changes in `camelToSnake()` at v1.176.1 HOT 7
- Typescript as peerDependency HOT 3
- Easier to use oneof=union generated code HOT 1
- Support default instances on singular/required fields HOT 6
- Option to include generated type registry in exports HOT 5
- Consider switching many types to interfaces HOT 2
- Incorrect message names in the generated code for repeated fields HOT 2
- `nestJs=true` and `useDate=true` interferes with `@google-cloud/firestore` HOT 1
- runing cmd 'protoc' in the bash script will miss some files HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ts-proto.