Added root object names for better api first code generation

This commit is contained in:
Daniel López García
2021-12-17 11:55:40 +01:00
parent f3f338ae0e
commit 0469142d05
3 changed files with 67 additions and 49 deletions
+33 -24
View File
@@ -22,12 +22,7 @@ paths:
content:
application/json:
schema:
type: array
description: List of productIds similar to a given one ordered by similarity
minItems: 0
uniqueItems: true
items:
type: integer
$ref: '#/components/schemas/SimilarProducts'
'/product/{productId}':
parameters:
- schema:
@@ -45,21 +40,35 @@ paths:
content:
application/json:
schema:
description: 'Product detail'
type: object
properties:
id:
type: string
minLength: 1
name:
type: string
minLength: 1
price:
type: number
availability:
type: boolean
required:
- id
- name
- price
- availability
$ref: '#/components/schemas/ProductDetail'
'404':
description: Product Not found
components:
schemas:
SimilarProducts:
type: array
description: 'List of similar product Ids to a given one ordered by similarity'
minItems: 0
uniqueItems: true
items:
type: string
example: ["1","2","3"]
ProductDetail:
description: 'Product detail'
type: object
properties:
id:
type: string
minLength: 1
name:
type: string
minLength: 1
price:
type: number
availability:
type: boolean
required:
- id
- name
- price
- availability