Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

proto3 - required / optional fields #287

Open
AmitM30 opened this issue Sep 7, 2021 · 4 comments
Open

proto3 - required / optional fields #287

AmitM30 opened this issue Sep 7, 2021 · 4 comments

Comments

@AmitM30
Copy link

AmitM30 commented Sep 7, 2021

Versions of relevant software used
0.15.0

What happened
I am using proto3, and after generating the typescript schema, only some fields are marked as optional. While, afaik, everything should be optional by default.

What you expected to happen

In the following definition:

syntax = "proto3";

message Location {
  string title = 1;
  string description = 2;
  Link link = 3;
}

link is marked as optional, rest required. Not sure why.

How to reproduce it (as minimally and precisely as possible):

we could use the above definition and reproduce this.

link.proto

syntax = "proto3";

message Link {
  string key = 1;
  string title = 2;
  string url = 3;
}

Full logs to relevant components

Anything else we need to know

@davidslaby
Copy link

@AmitM30 Have you solved this issue somehow? :) Thanks in advance.

@AmitM30
Copy link
Author

AmitM30 commented Jan 18, 2022

@AmitM30 Have you solved this issue somehow? :) Thanks in advance.

@davidslaby No. I am living with it.

@stale
Copy link

stale bot commented Apr 19, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Apr 19, 2022
@kimroen
Copy link

kimroen commented Jun 10, 2022

I came here to find out which arguments we need to pass to fix this behavior as well - most of the types generated from our protos say the fields are there when they could be missing.

I would expect all of these to have | undefined added to the end of their types. Making this change now would probably be quite the breaking change, but an option and then gradual move could work?

@stale stale bot removed the wontfix label Jun 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants