BREAKING CHANGE: replace resursive search with JSON pointer#9
Closed
essioc wants to merge 1 commit intoepics-modules:mainfrom
Closed
BREAKING CHANGE: replace resursive search with JSON pointer#9essioc wants to merge 1 commit intoepics-modules:mainfrom
essioc wants to merge 1 commit intoepics-modules:mainfrom
Conversation
Previously, the module recursively looped and checked key in the iterable. It had a limitation that it could not handle mixed types, root array, and empty key. JSON Pointer solves this problem because it can address all points in a JSON object whether it is an array or a dictionary. See also: https://datatracker.ietf.org/doc/html/rfc6901 BREAKING CHANGE: Previous json field addressing will no longer work
Contributor
Author
|
Reconsidering this merge request; there is some rework needed to add write support, which may change how the data address is configured. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Previously, the module recursively looped and checked key in the iterable. It had a limitation that it could not handle mixed types, root array, and empty key.
JSON Pointer solves this problem because it can address all points in a JSON object whether it is an array or a dictionary.
See also: https://datatracker.ietf.org/doc/html/rfc6901
Breaking change
Previous way of referring to JSON field will no longer work. If backward compatibility is desired, calling previous search method first and then applying JSON pointer (at cost of unspecified search speed)
Exception handling
There are new possible exceptions coming from to_string, json::at, and json::json_pointer. These errors were already being caught at the catch-all handler at following line, so new handling code was not necessary.
Other considerations
onMessageCb function may benefit from some refactoring, where the values are not always converted into string but into corresponding numeric types, by merging the two steps of identifying if it's JSON and whether the item exists or not, and then matching requested types and converting it into numeric as needed. This optimization was not carried out in this merge request.