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

jsonify uses non-standard mapping for protobuf map fields.

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 1.9.0
    • json api
    • Resource Mgmt: RI-16 51
    • 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

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

              Dates

                Created:
                Updated:
                Resolved: