File tree 2 files changed +17
-3
lines changed
2 files changed +17
-3
lines changed Original file line number Diff line number Diff line change 14
14
from service .handlers .utils .rest_api_resolver import ORDERS_PATH , app
15
15
from service .logic .create_order import create_order
16
16
from service .models .input import CreateOrderRequest
17
- from service .models .output import CreateOrderOutput , InternalServerErrorOutput
17
+ from service .models .output import CreateOrderOutput , InternalServerErrorOutput , InvalidRestApiRequest
18
18
19
19
20
20
@app .post (
25
25
responses = {
26
26
200 : {
27
27
'description' : 'The created order' ,
28
- 'content' : {'application/json' : {'schema' : {'$ref' : '#/components/schemas/CreateOrderOutput' }}},
28
+ 'content' : {'application/json' : {'model' : CreateOrderOutput }},
29
+ },
30
+ 442 : {
31
+ 'description' : 'Invalid create order request' ,
32
+ 'content' : {'application/json' : {'model' : InvalidRestApiRequest }},
29
33
},
30
34
501 : {
31
35
'description' : 'Internal server error' ,
32
- 'content' : {'application/json' : {'schema ' : InternalServerErrorOutput . model_json_schema () }},
36
+ 'content' : {'application/json' : {'model ' : InternalServerErrorOutput }},
33
37
},
34
38
},
35
39
tags = ['CRUD' ],
Original file line number Diff line number Diff line change
1
+ from typing import List
2
+
1
3
from pydantic import BaseModel
2
4
3
5
from service .models .order import Order
@@ -12,3 +14,11 @@ class CreateOrderOutput(Order):
12
14
13
15
class InternalServerErrorOutput (BaseModel ):
14
16
error : str = 'internal server error'
17
+
18
+
19
+ class Error (BaseModel ):
20
+ x : str
21
+
22
+
23
+ class InvalidRestApiRequest (BaseModel ):
24
+ details : List [Error ]
You can’t perform that action at this time.
0 commit comments