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
Allow unsetting (deleting) parameters #145
Conversation
if (j.find("value") == j.end()) { | ||
p = Parameter(name); // Value is not set (undefined). | ||
return; | ||
} |
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.
I think it would be more explicit if the value was set to null
(nlohmann::detail::value_t::null)
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.
I don't understand the comment here, null
and undefined are not the same thing.
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.
I was referring to foxglove/ws-protocol#354 (comment), where we chose to use undefined
(no value provided) instead of null
.
c55e737
to
19b451d
Compare
@@ -974,7 +974,14 @@ template <typename ServerConfiguration> | |||
inline void Server<ServerConfiguration>::publishParameterValues( | |||
ConnHandle hdl, const std::vector<Parameter>& parameters, | |||
const std::optional<std::string>& requestId) { | |||
nlohmann::json jsonPayload{{"op", "parameterValues"}, {"parameters", parameters}}; | |||
// Filter out parameters which are not set. |
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.
The spec currently does not declare what parameter message to expect when requesting a non-existing / deleted parameter. Should it be
{
"op": "parameterValues",
"parameters": []
}
or
{
"op": "parameterValues",
"parameters": [{ "name": "/deleted_param" }]
}
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.
The second example is not valid JSON. There is no undefined
literal in https://www.rfc-editor.org/rfc/rfc8259
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.
Adapted my first comment by removing the value
field
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.
I think the first is better?
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.
OK, that's also how it is currently implemented
@jhurliman OK for you to merge as is? |
Public-Facing Changes
Description
Implements the specification update in foxglove/ws-protocol#354