File tree Expand file tree Collapse file tree 3 files changed +8
-4
lines changed Expand file tree Collapse file tree 3 files changed +8
-4
lines changed Original file line number Diff line number Diff line change 11from jsonapi_pydantic import constants , v1_0
22
3- __version__ = "0.1.2 "
3+ __version__ = "0.1.3 "
44
55__all__ = ["constants" , "v1_0" ]
Original file line number Diff line number Diff line change @@ -23,10 +23,14 @@ class Resource(BaseModel):
2323
2424 @root_validator
2525 def check_all_values (cls , values : dict ) -> dict :
26+ attributes , relationships = values .get ("attributes" ), values .get ("relationships" )
27+ if not attributes and not relationships :
28+ return values
29+
2630 # More about these restrictions: https://jsonapi.org/format/#document-resource-object-fields
2731 try :
28- attributes = dict (values . get ( " attributes" ))
29- relationships = dict (values . get ( " relationships" ))
32+ attributes = dict (attributes ) if attributes else attributes
33+ relationships = dict (relationships ) if relationships else relationships
3034 except (ValueError , TypeError ):
3135 raise ValueError ("Attributes and relationships must be json objects." )
3236
Original file line number Diff line number Diff line change 11[tool .poetry ]
22name = " jsonapi-pydantic"
3- version = " 0.1.2 "
3+ version = " 0.1.3 "
44description = " JSON:API implementation with pydantic."
55
66authors = [" impocode <impocode@impocode.com>" ]
You can’t perform that action at this time.
0 commit comments