Add configuration for forcing case-sensitive key/tag matches in decoding. #81
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request proposes adding a new configuration option: CaseSensitiveKeys. If true, this would only allow for exact matches on struct Field/Tag names, whereas if false it would use the current behavior of doing Unicode code-folding on the key maps.
Example use case: The Experience API standard (xAPI, detailed here: https://github.com/adlnet/xAPI-Spec/blob/master/xAPI-Data.md#lrs-requirements ), which is defined on top of JSON, requires that "The LRS MUST reject Statements...where the case of a key does not match the case specified in this specification." Someone bringing in the JSON data and wanting to use mapstructure to copy it into appropriately defined structs has to be sure that the "id" key is "id" and not "ID" in order to validate within the specification.
Good test coverage included in pull request.
There's also a tiny performance perk by not having to iterate the map! :)