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

Support omit and emit of field default values in struct constants #507

Conversation

benjamin-bader
Copy link
Collaborator

Java: no change needed in ConstantBuilder; struct builders already include default values
Java: codegen had a bug where we forgot to include a static initializer if only struct constants were present; fixed here.
Kotlin: builder codepath guarded against missing required fields; restriction softened to allow leaving out default-valued fields
Kotlin: builderless codepath now accounts for default values
Schema: Struct validation now allows for missing fields with default values

@codecov-commenter
Copy link

Codecov Report

Merging #507 (0a38c90) into master (86a57f3) will increase coverage by 0.54%.
The diff coverage is 71.42%.

@@             Coverage Diff              @@
##             master     #507      +/-   ##
============================================
+ Coverage     59.73%   60.27%   +0.54%     
- Complexity      877      880       +3     
============================================
  Files            70       70              
  Lines          6608     6611       +3     
  Branches       1024     1026       +2     
============================================
+ Hits           3947     3985      +38     
+ Misses         2360     2325      -35     
  Partials        301      301              
Impacted Files Coverage Δ
.../com/microsoft/thrifty/kgen/KotlinCodeGenerator.kt 85.07% <33.33%> (+0.07%) ⬆️
.../com/microsoft.thrifty.gen/ThriftyCodeGenerator.kt 71.02% <100.00%> (+3.23%) ⬆️
...in/kotlin/com/microsoft/thrifty/schema/Constant.kt 79.61% <100.00%> (+1.23%) ⬆️
...otlin/com/microsoft.thrifty.gen/ConstantBuilder.kt 36.36% <0.00%> (+7.27%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@benjamin-bader benjamin-bader merged commit d595d63 into microsoft:master Dec 8, 2022
@benjamin-bader benjamin-bader deleted the struct-consts-with-default-field-values branch December 8, 2022 20:07
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

Successfully merging this pull request may close these issues.

2 participants