You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@mesos.apache.org by "Neil Conway (JIRA)" <ji...@apache.org> on 2016/11/09 20:47:00 UTC
[jira] [Updated] (MESOS-6568) JSON serialization should not omit
empty arrays in HTTP APIs
[ https://issues.apache.org/jira/browse/MESOS-6568?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Neil Conway updated MESOS-6568:
-------------------------------
Description:
When using the JSON content type with the HTTP APIs, a {{repeated}} protobuf field is omitted entirely from the JSON serialization of the message. For example, this is a response to the {{GetTasks}} call:
{noformat}
{
"get_tasks": {
"tasks": [{...}]
},
"type": "GET_TASKS"
}
{noformat}
I think it would be better to include empty arrays for the other fields of the message ({{pending_tasks}}, {{completed_tasks}}, etc.). Advantages:
# Consistency with the old HTTP endpoints, e.g., /state
# Semantically, an empty array is more accurate. The master's response should be interpreted as saying it doesn't know about any pending/completed tasks; that is more accurately conveyed by explicitly including an empty array, not by omitting the key entirely.
was:
When using the JSON content type with the HTTP APIs, a {{repeated}} protobuf field is omitted entirely from the JSON serialization of the message. For example, this is a response to the {{GetTasks}} call:
{noformat}
{
"get_tasks": {
"tasks": [{...}]
},
"type": "GET_TASKS"
}
{noformat}
I think it would be better to include empty arrays for the other fields of the message ({{pending_tasks}}, {{completed_tasks}}, etc.). Advantages:
1. Consistency with the old HTTP endpoints, e.g., /state
2. Semantically, an empty array is more accurate. The master's response should be interpreted as saying it doesn't know about any pending/completed tasks; that is more accurately conveyed by explicitly including an empty array, not by omitting the key entirely.
> JSON serialization should not omit empty arrays in HTTP APIs
> ------------------------------------------------------------
>
> Key: MESOS-6568
> URL: https://issues.apache.org/jira/browse/MESOS-6568
> Project: Mesos
> Issue Type: Improvement
> Components: HTTP API
> Reporter: Neil Conway
> Labels: mesosphere
>
> When using the JSON content type with the HTTP APIs, a {{repeated}} protobuf field is omitted entirely from the JSON serialization of the message. For example, this is a response to the {{GetTasks}} call:
> {noformat}
> {
> "get_tasks": {
> "tasks": [{...}]
> },
> "type": "GET_TASKS"
> }
> {noformat}
> I think it would be better to include empty arrays for the other fields of the message ({{pending_tasks}}, {{completed_tasks}}, etc.). Advantages:
> # Consistency with the old HTTP endpoints, e.g., /state
> # Semantically, an empty array is more accurate. The master's response should be interpreted as saying it doesn't know about any pending/completed tasks; that is more accurately conveyed by explicitly including an empty array, not by omitting the key entirely.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)