Open domesticmouse opened 1 year ago
The following schema compiles correctly:
openapi: 3.0.0 info: title: AnAPI version: 0.0.2-alpha paths: /inventory: get: operationId: Inventory Listing parameters: [] responses: '200': description: Inventory content: application/json: schema: $ref: '#/components/schemas/item_list' components: schemas: item_list: type: object required: [items] properties: items: type: array items: $ref: '#/components/schemas/item' item: type: object required: [name, id] properties: name: type: string id: type: string
The following, more compact version, does not:
openapi: 3.0.0 info: title: AnAPI version: 0.0.2-alpha paths: /inventory: get: operationId: Inventory Listing parameters: [] responses: '200': description: Inventory content: application/json: schema: type: array items: $ref: '#/components/schemas/item' components: schemas: item: type: object required: [name, id] properties: name: type: string id: type: string
The trick being FastAPI generates the second kind of schema, and implements it as if it were the first.
The following schema compiles correctly:
The following, more compact version, does not:
The trick being FastAPI generates the second kind of schema, and implements it as if it were the first.