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

Add convert from UPPERCASE decoding key strategy #214

Merged
merged 2 commits into from Jul 29, 2021

Conversation

huwr
Copy link
Contributor

@huwr huwr commented Feb 27, 2021

This will convert from ALL_CAPS_SNAKE_CASE to camelCase.

Previously, there was only snake_case, kebab-case, and first-letter-only Capitalised. To do ALL_CAPS, one needed to use a custom key decoding strategy.

I've been using this to make a decoder for BeerXML, which tends to have the keys capitalised.

This will convert from ALL_CAPS_SNAKE_CASE to camelCase.

Previously, there was only snake_case, kebab-case, and first-letter-only Capitalised. To do ALL_CAPS, one would need to have used a custom key decoding strategy.
@codecov
Copy link

codecov bot commented Feb 27, 2021

Codecov Report

Merging #214 (0e19ae8) into main (a469f60) will increase coverage by 0.12%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #214      +/-   ##
==========================================
+ Coverage   73.50%   73.62%   +0.12%     
==========================================
  Files          46       46              
  Lines        2404     2408       +4     
==========================================
+ Hits         1767     1773       +6     
+ Misses        637      635       -2     
Impacted Files Coverage Δ
Sources/XMLCoder/Decoder/XMLDecoder.swift 78.41% <100.00%> (+1.77%) ⬆️
...es/XMLCoder/Decoder/XMLDecoderImplementation.swift 67.74% <100.00%> (+0.19%) ⬆️

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 a469f60...0e19ae8. Read the comment docs.

Copy link
Collaborator

@MaxDesiatov MaxDesiatov left a comment

Choose a reason for hiding this comment

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

Sorry for the delay. This looks great, thanks!

@MaxDesiatov MaxDesiatov merged commit 338d503 into CoreOffice:main Jul 29, 2021
spotlightishere pushed a commit to WiiLink24/XMLCoder that referenced this pull request Aug 6, 2021
* Add convert from UPPERCASE decoding key strategy

This will convert from ALL_CAPS_SNAKE_CASE to camelCase.

Previously, there was only snake_case, kebab-case, and first-letter-only Capitalised. To do ALL_CAPS, one would need to have used a custom key decoding strategy.

* Update Tests/XMLCoderTests/Minimal/KeyedTests.swift

Co-authored-by: Max Desiatov <max@desiatov.com>
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.

None yet

2 participants