-
Notifications
You must be signed in to change notification settings - Fork 1.4k
fix: handle nullability for optional fields #2011
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
Merged
danielbankhead
merged 26 commits into
protobufjs:master
from
martin-traverse:fix/typescript_optional_support
Aug 13, 2024
Merged
Changes from all commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
b38a668
Fixes optional handling for class-level comments (JS) and interfaces …
358d336
Hide the fix for PB3 optional type declarations behind the flag --pb3…
martin-traverse 94556f9
Do not use null-defaults to decide type signature for pb3-optionals (…
martin-traverse 2bd0b43
New implementation that explicitly respects the optional keyword
martin-traverse 4793755
Fix options list in pbjs
martin-traverse f2a69a5
Add tests for handling optional fields in both proto2 and proto3 syntax
martin-traverse 996e445
Explicit handling of proto3 syntax in the parser and static generator
martin-traverse aa61793
Only look up proto syntax once per type in the static generator
martin-traverse f2ed6e0
Fix lint warnings
martin-traverse 856af47
Use field options in proto3 instead of adding an extra property
martin-traverse ccd640e
Do not require repeated or map fields in the object properties (i.e. …
martin-traverse 09f577a
Do not generate doc comments for virtual oneOfs
martin-traverse 6204b2d
Address codestyle comment (braces for if/else)
martin-traverse 31f85e9
Address comment for default syntax
martin-traverse ed5980c
Change config flag to --null-semantics and update comments
martin-traverse bee997d
Update PBJS and README for new --null-semantics flag
martin-traverse dee3083
Update tests for --null-semantics flag
martin-traverse 50255d0
Fix one lint warning
martin-traverse 623477b
Include tests for interface / message types under --null-semantics
martin-traverse d5700a5
Implement propagation of interface / message types under --null-seman…
martin-traverse 9bcc006
Update CLI options help and README
martin-traverse fda51db
Allow for other syntax options than "proto2" or "proto3"
martin-traverse 8e0027a
Make parentIsInterface default to false in toJsType()
94bfbbc
Allow undefined values (but not nulls) for implicit presence fields i…
martin-traverse 258679c
Update tests for proto3 to let implicit members be optional but not n…
martin-traverse c478e1f
Add braces to if/else clauses for readability on all code touched by …
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
syntax = "proto3"; | ||
|
||
message OptionalFields { | ||
message SubMessage { | ||
string a = 1; | ||
} | ||
|
||
optional SubMessage a = 1; | ||
optional string b = 2; | ||
optional uint32 c = 3; | ||
uint32 d = 4; | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.