Я пытаюсь определить массив объектов в swagger в качестве ответа:
/product:
get:
operationId: api.product.read_all
tags:
- Product
summary: Read the Products
description: Read the Products
responses:
200:
description: Successfully read product set operation
schema:
type: array
items:
oneOf:
- $ref: '#/definitions/product'
Но нахожу ошибки у тех:
Schema error at paths['/product'].get.responses['200']
should NOT have additional properties
additionalProperty: description, schema
Jump to line 138
Schema error at paths['/product'].get.responses['200'].schema
should NOT have additional properties
additionalProperty: items
Jump to line 140
Schema error at paths['/product'].get.responses['200'].schema
should match exactly one schema in oneOf
Jump to line 140
Schema error at paths['/product'].get.responses['200'].schema.type
should be equal to one of the allowed values
allowedValues: file
Jump to line 141
Schema error at paths['/product'].get.responses['200'].schema.items
should NOT have additional properties
additionalProperty: anyOf
Jump to line 142
Schema error at paths['/product'].get.responses['200'].schema.items
should be array
Jump to line 142
Schema error at paths['/product'].get.responses['200'].schema.items
should match some schema in anyOf
Jump to line 142
Я знаю, что могу использовать вложенный массив с таким объектом, как:
schema:
type: array
items:
properties:
id:
type: string
description: Id of the cat
name:
type: string
description: category name
Но я хочу применить ссылку на объект внутреннего массива к некоторым уже определенным мною объектам. Может swagger, как это сделать?
Я использую Swagger 2.0
Возможный дубликат Возврат массива объектов, который правильно определяет ответ SDK и Вернуть массив объектов в SwaggerHub
массив $ ref. Благодарность
См. Связанные с ^^ вопросы и ответы.



Сразу уточнить - нужен ли вам массив
$ref? Или массив массивов$ref? Или что-то другое?