jamescourtney / FlatSharp

Fast, idiomatic C# implementation of Flatbuffers
Apache License 2.0
497 stars 50 forks source link

Add fs_preserveFieldCasing attribute #306

Closed joncham closed 1 year ago

joncham commented 1 year ago

This enables overriding the behavior of --normalize-field-names at the field, struct, or table level.

This PR attempts to implements a solution for issue #305 . I did make the attribute a bit more verbose as fs_preserveFieldCasing but am happy to use the original suggestion of fs_preserveCase as well.

joncham commented 1 year ago

@jamescourtney I don't seem to have permission to add reviewer but FYI. cc @vvuk

jamescourtney commented 1 year ago

Thanks for this! I always appreciate contributions. I'll try to figure out how to get @vvuk added as a contributor. In the meantime, I will take a look at this, but I'll need you to be a little patient as real-life obligations prevent me from spending too much time on FlatSharp these days. Thanks again for the contribution -- I'll get back to you with my feedback in a few days.

codecov[bot] commented 1 year ago

Codecov Report

Merging #306 (7b85fb9) into main (f37672c) will decrease coverage by 0.02%. The diff coverage is 81.81%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #306      +/-   ##
==========================================
- Coverage   95.75%   95.73%   -0.03%     
==========================================
  Files         114      114              
  Lines        7806     7816      +10     
  Branches      740      746       +6     
==========================================
+ Hits         7475     7483       +8     
  Misses        229      229              
- Partials      102      104       +2     
Impacted Files Coverage Δ
src/FlatSharp.Compiler/MetadataKeys.cs 100.00% <ø> (ø)
src/FlatSharp.Compiler/FlatSharpCompiler.cs 90.80% <77.77%> (-0.53%) :arrow_down:
...tSharp.Compiler/SchemaModel/FlatSharpAttributes.cs 97.50% <100.00%> (+0.03%) :arrow_up:
...Compiler/SchemaModel/MutableFlatSharpAttributes.cs 83.33% <100.00%> (+0.72%) :arrow_up:

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 f37672c...7b85fb9. Read the comment docs.

vvuk commented 1 year ago

@jamescourtney thanks -- @joncham and I work together, so you may see PRs for Unity integration coming from both of us over the next little while.

joncham commented 1 year ago

@jamescourtney do you want a followup PR with different naming?

jamescourtney commented 1 year ago

@joncham -- I think it's fine. I may change it to fs_literalName, but you seem to have bigger fish to fry :)