Skip to content
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

protoc-gen-swagger: fix description of google/protobuf/struct.proto types #989

Closed
johanbrandhorst opened this issue Aug 11, 2019 · 0 comments · Fixed by #990
Closed

protoc-gen-swagger: fix description of google/protobuf/struct.proto types #989

johanbrandhorst opened this issue Aug 11, 2019 · 0 comments · Fixed by #990
Assignees

Comments

@johanbrandhorst
Copy link
Collaborator

The current swagger definition of google.protobuf.Struct looks like so:

{
  "fields": {
    "additionalProp1": {
      "null_value": "NULL_VALUE",
      "number_value": 0,
      "string_value": "string",
      "bool_value": true,
      "struct_value": {
        "fields": {
          "additionalProp1": {
            "null_value": "NULL_VALUE",
            "number_value": 0,
            "string_value": "string",
            "bool_value": true,
            "list_value": {
              "values": [
                null
              ]
            }
          },
          "additionalProp2": {
            "null_value": "NULL_VALUE",
            "number_value": 0,
            "string_value": "string",
            "bool_value": true,
            "list_value": {
              "values": [
                null
              ]
            }
          },
          "additionalProp3": {
            "null_value": "NULL_VALUE",
            "number_value": 0,
            "string_value": "string",
            "bool_value": true,
            "list_value": {
              "values": [
                null
              ]
            }
          }
        }
      },
      "list_value": {
        "values": [
          {
            "null_value": "NULL_VALUE",
            "number_value": 0,
            "string_value": "string",
            "bool_value": true,
            "list_value": {
              "values": [
                null
              ]
            }
          }
        ]
      }
    },
    "additionalProp2": {
      "null_value": "NULL_VALUE",
      "number_value": 0,
      "string_value": "string",
      "bool_value": true,
      "struct_value": {
        "fields": {
          "additionalProp1": {
            "null_value": "NULL_VALUE",
            "number_value": 0,
            "string_value": "string",
            "bool_value": true,
            "list_value": {
              "values": [
                null
              ]
            }
          },
          "additionalProp2": {
            "null_value": "NULL_VALUE",
            "number_value": 0,
            "string_value": "string",
            "bool_value": true,
            "list_value": {
              "values": [
                null
              ]
            }
          },
          "additionalProp3": {
            "null_value": "NULL_VALUE",
            "number_value": 0,
            "string_value": "string",
            "bool_value": true,
            "list_value": {
              "values": [
                null
              ]
            }
          }
        }
      },
      "list_value": {
        "values": [
          {
            "null_value": "NULL_VALUE",
            "number_value": 0,
            "string_value": "string",
            "bool_value": true,
            "list_value": {
              "values": [
                null
              ]
            }
          }
        ]
      }
    },
    "additionalProp3": {
      "null_value": "NULL_VALUE",
      "number_value": 0,
      "string_value": "string",
      "bool_value": true,
      "struct_value": {
        "fields": {
          "additionalProp1": {
            "null_value": "NULL_VALUE",
            "number_value": 0,
            "string_value": "string",
            "bool_value": true,
            "list_value": {
              "values": [
                null
              ]
            }
          },
          "additionalProp2": {
            "null_value": "NULL_VALUE",
            "number_value": 0,
            "string_value": "string",
            "bool_value": true,
            "list_value": {
              "values": [
                null
              ]
            }
          },
          "additionalProp3": {
            "null_value": "NULL_VALUE",
            "number_value": 0,
            "string_value": "string",
            "bool_value": true,
            "list_value": {
              "values": [
                null
              ]
            }
          }
        }
      },
      "list_value": {
        "values": [
          {
            "null_value": "NULL_VALUE",
            "number_value": 0,
            "string_value": "string",
            "bool_value": true,
            "list_value": {
              "values": [
                null
              ]
            }
          }
        ]
      }
    }
  }
}

This is the structure of the protobuf message, not how it's parsed by the parser. It should be simple object, since it supports arbitray JSON.

Having briefly looked at the source (https://github.com/grpc-ecosystem/grpc-gateway/blob/master/protoc-gen-swagger/genswagger/template.go#L21), I think we're also missing the other struct.proto types, ListValue, Value and NullValue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant