-
Notifications
You must be signed in to change notification settings - Fork 15.9k
Open
Labels
Description
What language does this apply to?
This is concerning the python google.protobuf.json_format
Describe the problem you are trying to solve.
I am trying to convert proto message to json. For example
type: OBJECT
properties {
key: "stories"
value {
type: ARRAY
items {
type: OBJECT
properties {
key: "category"
value {
type: STRING
description: "News category"
}
}
required: "category"
}
max_items: 10
min_items: 10
}
}
required: "stories"
json_format.MessageToJson(proto) outputs
{
"type": "OBJECT",
"properties": {
"stories": {
"type": "ARRAY",
"items": {
"type": "OBJECT",
"properties": {
"category": {
"type": "STRING",
"description": "News category"
}
},
"required": [
"category"
]
},
"maxItems": "10",
"minItems": "10"
}
},
"required": [
"stories"
]
}
In the output maxItems and minItems are string "10", not integer. This causes trouble when validating the json using jsonschema.validate().
Describe the solution you'd like
The output of {min|max}_{property} should be integer, not string.