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

Map camelCased keys to fields in structs. #251

Merged
merged 1 commit into from
Nov 19, 2018

Conversation

tom5760
Copy link
Contributor

@tom5760 tom5760 commented Nov 16, 2018

The name for each field in a struct is used to look up a key in the TOML
tree. A few different (case-sensitive) forms of this name are tried.
Previously, the current, lower-cased, and title-cased versions of the
name are tried. This precludes camelCased keys from mapping back to
fields in structs. This change adds camelCase to the set of keys to
try.

For example, the following TOML:

  fooBar = 10

Would previously not map to the following struct:

  type Foo struct {
    FooBar int
  }

This change corrects this.

Fixes #249

The name for each field in a struct is used to look up a key in the TOML
tree.  A few different (case-sensitive) forms of this name are tried.
Previously, the current, lower-cased, and title-cased versions of the
name are tried.  This precludes camelCased keys from mapping back to
fields in structs.  This change adds camelCase to the set of keys to
try.

For example, the following TOML:

  fooBar = 10

Would previously *not* map to the following struct:

  type Foo struct {
    FooBar int
  }

This change corrects this.
@codecov
Copy link

codecov bot commented Nov 16, 2018

Codecov Report

Merging #251 into master will increase coverage by 0.02%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #251      +/-   ##
==========================================
+ Coverage   89.16%   89.18%   +0.02%     
==========================================
  Files           9        9              
  Lines        1670     1674       +4     
==========================================
+ Hits         1489     1493       +4     
  Misses        129      129              
  Partials       52       52
Impacted Files Coverage Δ
marshal.go 89.29% <100%> (+0.12%) ⬆️

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 aa79e12...3f6829a. Read the comment docs.

Copy link
Owner

@pelletier pelletier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for putting that together!

@pelletier pelletier merged commit 0a1666a into pelletier:master Nov 19, 2018
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