-
Notifications
You must be signed in to change notification settings - Fork 277
[TG-9189] Value retriever: Allow @nondetLength field to be false. #5043
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -199,9 +199,14 @@ static bool has_nondet_length(const jsont &json) | |
/// (typed vs. untyped). | ||
static jsont get_untyped(const jsont &json, const std::string &object_key) | ||
{ | ||
if(get_type(json) || has_nondet_length(json)) | ||
return json[object_key]; | ||
return json; | ||
if(!json.is_object()) | ||
return json; | ||
|
||
const auto &json_object = to_json_object(json); | ||
PRECONDITION( | ||
get_type(json) || json_object.find("@nondetLength") != json_object.end()); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ⛏️ We could be more precise and assert the current precondition only if There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. precondition is split There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This introduced problems, so I reverted to the initial solution. |
||
|
||
return json[object_key]; | ||
} | ||
|
||
/// \ref get_untyped for primitive types. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you really expecting just any old thing here when it's not an object, or do you expect something specific, such as null for example? If so, check for your expectation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@smowton It could be pretty much anything so I think this change makes sense.