Uploaded image for project: 'Mesos'
  1. Mesos
  2. MESOS-9901

jsonify uses non-standard mapping for protobuf map fields.

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.9.0
    • Component/s: json api
    • Labels:
    • Target Version/s:
    • Sprint:
      Resource Mgmt: RI-16 51
    • Story Points:
      3

      Description

      Jsonify current treats protobuf as a regular repeated field. For example, for the schema

      message QuotaConfig {
        required string role = 1;
      
        map<string, Value.Scalar> guarantees = 2;
        map<string, Value.Scalar> limits = 3;
      }
      

      it will produce:

      {
        "configs": [
          {
            "role": "role1",
            "guarantees": [
              {
                "key": "cpus",
                "value": {
                  "value": 1
                }
              },
              {
                "key": "mem",
                "value": {
                  "value": 512
                }
              }
            ]
          }
        ]
      }
      

      This output cannot be parsed back to proto messages. We need to specialize jsonify for Maps type to get the standard output:

          {
            "configs": [
              {
                "role": "role1",
                "guarantees": {
                  "cpus": 1,
                  "mem": 512
                }
              }
            ]
          }
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                mzhu Meng Zhu
                Reporter:
                mzhu Meng Zhu
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: