Added root object names for better api first code generation
This commit is contained in:
+33
-24
@@ -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
|
||||
@@ -1,7 +1,7 @@
|
||||
# Backend dev technical test
|
||||
We want to offer a new feature to our customers showing similar products to the one they are seeing. To do this we agreed with our front-end applications to create a new REST API that will provide them the product detail of similar products to a given one. [Here](./similarProducts.yaml) is the contract we agreed.
|
||||
We want to offer a new feature to our customers showing similar products to the one they are currently seeing. To do this we agreed with our front-end applications to create a new REST API operation that will provide them the product detail of the similar products for a given one. [Here](./similarProducts.yaml) is the contract we agreed.
|
||||
|
||||
We already have an endpoint that provides the product Ids similar to a given one. We also have another endpoint that returns the product detail by productId. [Here](./existingApis.yaml) is the documentation of the existing APIs.
|
||||
We already have an endpoint that provides the product Ids similar for a given one. We also have another endpoint that returns the product detail by product Id. [Here](./existingApis.yaml) is the documentation of the existing APIs.
|
||||
|
||||
**Create a Spring boot application that exposes the agreed REST API on port 5000.**
|
||||
|
||||
@@ -30,4 +30,4 @@ Browse [http://localhost:3000/d/Le2Ku9NMk/k6-performance-test](http://localhost:
|
||||
The following topics will be considered:
|
||||
- Code clarity and maintainability
|
||||
- Performance
|
||||
- Resilence
|
||||
- Resilence
|
||||
+31
-22
@@ -21,25 +21,34 @@ paths:
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: array
|
||||
description: 'List of similar products to a given one ordered by similarity'
|
||||
minItems: 0
|
||||
uniqueItems: true
|
||||
items:
|
||||
type: object
|
||||
required:
|
||||
- id
|
||||
- name
|
||||
- price
|
||||
- availability
|
||||
properties:
|
||||
id:
|
||||
type: string
|
||||
minLength: 1
|
||||
name:
|
||||
type: string
|
||||
minLength: 1
|
||||
price:
|
||||
type: number
|
||||
availability:
|
||||
type: boolean
|
||||
$ref: '#/components/schemas/SimilarProducts'
|
||||
'404':
|
||||
description: Product Not found
|
||||
components:
|
||||
schemas:
|
||||
SimilarProducts:
|
||||
type: array
|
||||
description: 'List of similar products to a given one ordered by similarity'
|
||||
minItems: 0
|
||||
uniqueItems: true
|
||||
items:
|
||||
$ref: '#/components/schemas/ProductDetail'
|
||||
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
|
||||
Reference in New Issue
Block a user