dredd 期待 swagger 中的参数示例 json

dredd is expecting example of parameter in swagger json

我做了第一个 swagger api 规范,dredd 给出了错误:

error: Compilation error in file '../../docs/swagger.json': Required URI parameter 'id_person' has no example or default value. (person > /person/{id_person} > Updates a already existing person ID with form data)

所以我给了参数一个默认值,现在从 dredd 收到警告:

Required URI parameter 'id_person' has a default value. Default value for a required parameter doesn't make sense from API description perspective. Use example value instead.

我想在规范中给出示例 ID,但我在 Swagger 规范中找不到具体方法。

我吹嘘的片段:

"post": {
                "tags": ["person"],
                "summary": "Updates a already existing person ID with form data",
                "operationId": "createNewPerson",
                "consumes": ["application/x-www-form-urlencoded"],
                "produces": ["application/json", "application/xml"],
                "parameters": [
                    {
                        "name": "id_person",
                        "in": "path",
                        "description": "ID of person to update",
                        "required": true,
                        "type": "integer",
                        "format": "int64",
                        "default": 1
                    },

根据 https://dredd.readthedocs.io/en/latest/how-to-guides/#example-values-for-request-parameters Dredd支持x-example扩展属性指定参数示例:

                "parameters": [
                    {
                        "name": "id_person",
                        "in": "path",
                        "description": "ID of person to update",
                        "required": true,
                        "type": "integer",
                        "format": "int64",
                        "x-example": 1
                    },