Passed
Push — master ( 9301e1...0bc911 )
by Mingyu
01:47
created

app.views.sample.api.SampleAPI.post()   A

Complexity

Conditions 1

Size

Total Lines 5
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 4
dl 0
loc 5
rs 10
c 0
b 0
f 0
cc 1
nop 1
1
from app.context import context_property
2
from app.decorators.validation import validate_with_pydantic, PayloadLocation
3
from app.views.base import BaseResource
4
from app.views.sample.schema import Post
5
6
7
class SampleAPI(BaseResource):
8
    @validate_with_pydantic(PayloadLocation.JSON, Post)
9
    def post(self):
10
        payload = context_property.request_payload
11
12
        return payload.dict(), 201
13