Файл Swagger работает как ожидается с предупреждением.Файл Swagger с предупреждением
{
'swagger': "2.0",
"info": {
"version": "3.0",
"title": "Sample Service",
},
"schemes": [ "http" ],
"host": "sampleservice.azurewebsites.net",
"paths": {
"/": {
"post": {
"summary": "Sample service",
"description": "sample service",
"parameters": [
{
"name": "Input",
"in": "body",
"description": "valid input",
"schema": {
"type": "object",
"properties": {
"MainAttr-1": {
"required": [ "Attr-1" ],
"type": "object",
"properties": {
"Attr-1": {
"description": "Attr-1",
"required": true,
"type": "string"
},
"Attr-2": {
"description": "Attr-2",
"required": false,
"type": "string"
},
"Attr-3": {
"description": "Attr-3",
"required": false,
"type": "boolean"
},
"Attr-4": {
"description": "Attr-4",
"required": false,
"type": "boolean"
},
"Attr-5": {
"description": "Attr-5",
"required": false,
"type": "string"
}
}
},
"MainAttr-2": {
"type": "array",
"items": {
"type": "object",
"required": [ "Attr-1", "Attr-3", "Attr-5", "Attr-8" ],
"properties": {
"Attr-1": {
"description": "Attr-1",
"required": true,
"type": "string"
},
"Attr-2": {
"description": "Attr-2",
"required": false,
"type": "string"
},
"Attr-3": {
"description": "Attr-3",
"required": true,
"type": "boolean"
},
"Attr-4": {
"description": "Attr-4",
"required": false,
"type": "boolean"
},
"Attr-5": {
"description": "Attr-5",
"required": true,
"type": "string"
},
"Attr-6": {
"description": "Attr-6",
"required": false,
"type": "string"
},
"Attr-7": {
"description": "Attr-7",
"required": false,
"type": "string"
},
"Attr-8": {
"description": "Attr-8",
"required": true,
"type": "string"
}
}
}
}
}
}
}
],
"responses": {
"200": {
"description": "success"
}
}
}
}
}
}
Выпуск-1) Предупреждение должно быть удалены
Выпуск-2) атр-3 в "MainAttr-2" является атрибутом логического типа и требуется. Но когда я выбираю «ложь» из раскрывающегося списка, он обрабатывается как недопустимый ввод. Он рассматривает только «истинный» как действительный ввод. (Любой атрибут Boolean, который требуется для такого поведения)
Из-за этого предупреждения я не могу доставить код.
Заранее спасибо.
Благодарим за отзыв. Тем не менее, я получаю такое же предупреждение. – Ganesh
Обязательно удалите атрибут 'required' из ВСЕХ свойств (' Attr-1' - 'Attr-8') и оставьте его только на уровне объекта (списки под' MainAttr-1' и 'MainAttr-2'). – Helen
Спасибо Хелен. Исправлена ошибка – Ganesh