Swagger дает структурные ошибки - PullRequest
0 голосов
/ 06 мая 2020

Я получаю следующие ошибки в openAPI 3.0:

Structural error at components.schemas.put_400.properties.errors
should NOT have additional properties
additionalProperty: readonly
Jump to line 1613
Structural error at components.schemas.patch_400.properties.errors
should NOT have additional properties
additionalProperty: success
Jump to line 1648

это то место, где возникают ошибки (для первого):

"put_400": {
            "description": "Bad Request. Failed to validate the payload",
            "type": "object",
            "example": {
                "errors": [
                    "serialId: serialId is required"
                ],
                "success": false
            },
            "properties": {
                "errors": {
                    "type": "object",
                    "readonly": true
                },
                "success": {
                    "type": "boolean",
                    "example": false
                }
            }
        }

для второго:

   "patch_400": {
                "description": "Bad Request. Failed to validate the payload.",
                "type": "object",
                "example": {
                    "message": "invalid character \\n in string literal",
                    "success": false
                },
                "properties": {
                    "message": {
                        "type": "object",
                        "readOnly": true
                    },
                    "errors": {
                        "type": "object",
                        "success": "false;" 
                    }
                }
            }

По инте rnet много не нашел. Любая помощь будет оценена. Спасибо.

1 Ответ

1 голос
/ 06 мая 2020

Чтобы исправить первую ошибку, измените readonly на readOnly (с буквой O).

Что касается второй ошибки, я думаю, вам нужно изменить

"errors": {
  "type": "object",
  "success": "false;"
}

на

"success": {
  "type": "boolean",
  "example": false
}

, как используется в put_400.

...