Closed wuzechen closed 4 years ago
Hi,
I guess you want something like this: http://springbot.github.io/json-api/extensions/bulk/ ?
I just commited a change that implements this but it needs improvements: the POST works with
{data : [{..},{..}] }
but the swagger isn't created and PATCH doesn't work.
Thanks for your reply. There is another issue about bulk insert. Follow the http://springbot.github.io/json-api/extensions/bulk/ Content-type of headers should be application/vnd.api+json; ext=bulk If I try to use this header, it gives me a header error. I fixed in safrs/request.py and safrs/jsonapi.py like this safrs/request.py
class SAFRSRequest(Request):
- jsonapi_content_types = ["application/json", "application/vnd.api+json"]
+ jsonapi_content_types = ["application/json", "application/vnd.api+json", "application/vnd.api+json; ext=bulk"]
+ jsonapi_content_bulk_types = ["application/vnd.api+json; ext=bulk"]
is_jsonapi = False
+ is_bulk = False
def __init__(self, *args, **kwargs):
"""
constructor
"""
super().__init__(*args, **kwargs)
if self.content_type in self.jsonapi_content_types:
self.is_jsonapi = True
self.parameter_storage_class = TypeConversionDict
+ if self.content_type in self.jsonapi_content_bulk_types:
+ self.is_bulk = True
self.parse_jsonapi_args()
safrs/jsonapi.py
safrs.log.debug("method {} args {}".format(self.method_name, args))
- if request.is_jsonapi:
+ if request.is_jsonapi and not request.is_bulk:
args["self"] = instance
result = method(**args)
ok, thanks I'll implement it like that by next week.
I've committed support for bulk extension.
This still requires some improvement though.
v2.6.0 contains the bulk create functionality, it's undocumented for now. Also, bulk patch doesn't work either.
Hi, this is a very good tool to build the API quickly and I am happy to use it. Is there a way to bulk create rows?