diff --git a/docs/conf.py b/docs/conf.py index 9cc02a8..4783f0f 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -61,9 +61,9 @@ # built documents. # # The short X.Y version. -version = "0.1" +version = "1.0" # The full version, including alpha/beta/rc tags. -release = "0.1" +release = "1.0.4" # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. diff --git a/docs/img/schema.png b/docs/img/schema.png index ee9ec67..aec7af3 100644 Binary files a/docs/img/schema.png and b/docs/img/schema.png differ diff --git a/flask_combo_jsonapi/resource.py b/flask_combo_jsonapi/resource.py index bacc4f8..58facab 100644 --- a/flask_combo_jsonapi/resource.py +++ b/flask_combo_jsonapi/resource.py @@ -188,7 +188,10 @@ def post(self, *args, **kwargs): obj = self.create_object(data, kwargs) - result = schema.dump(obj) + if obj is None: + result = {"data": None} + else: + result = schema.dump(obj) if result["data"].get("links", {}).get("self"): final_result = (result, 201, {"Location": result["data"]["links"]["self"]}) diff --git a/flask_combo_jsonapi/schema.py b/flask_combo_jsonapi/schema.py index 02473b4..39ebca9 100644 --- a/flask_combo_jsonapi/schema.py +++ b/flask_combo_jsonapi/schema.py @@ -140,7 +140,7 @@ def get_related_schema(schema, field): :param field: the relationship field :return Schema: the related schema """ - return schema._declared_fields[field].__dict__['_Relationship__schema'] + return schema._declared_fields[field].schema def get_schema_from_type(resource_type): diff --git a/setup.py b/setup.py index 89789d0..5e0d2e5 100644 --- a/setup.py +++ b/setup.py @@ -1,7 +1,7 @@ import os from setuptools import setup, find_packages -__version__ = "1.0.3" +__version__ = "1.0.4" requirements_filepath = os.path.join(os.path.dirname(__name__), "requirements.txt")