Drvi / ProtocolBuffers.jl

4 stars 0 forks source link

Make struct fields nullable by default (with an override) #4

Closed Drvi closed 2 years ago

Drvi commented 2 years ago

Now all struct fields are optional by default (as they should in proto3). When the user knows that field will be always sent over the wire, they can tell protojl to treat that field as required (which is a proto2 concept). This will make the struct field have type T instead of Union{Nothing,T} which might be desirable. This is the api:

protojl(...; force_required=Dict("import/proto/path" => Set(["StructName.field_name", ...]), ...))
codecov-commenter commented 2 years ago

Codecov Report

Merging #4 (d618c27) into master (a7ac0e5) will increase coverage by 0.04%. The diff coverage is 90.90%.

@@            Coverage Diff             @@
##           master       #4      +/-   ##
==========================================
+ Coverage   88.01%   88.05%   +0.04%     
==========================================
  Files          21       21              
  Lines        2337     2345       +8     
==========================================
+ Hits         2057     2065       +8     
  Misses        280      280              
Impacted Files Coverage Δ
src/codegen/toplevel_definitions.jl 96.49% <85.71%> (+0.26%) :arrow_up:
src/codegen/modules.jl 83.33% <100.00%> (ø)
src/codegen/types.jl 89.58% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update a7ac0e5...d618c27. Read the comment docs.