Comments (5)
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.
from safrs.
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)
from safrs.
ok, thanks
I'll implement it like that by next week.
from safrs.
I've committed support for bulk extension.
This still requires some improvement though.
from safrs.
v2.6.0 contains the bulk create functionality, it's undocumented for now.
Also, bulk patch doesn't work either.
from safrs.
Related Issues (20)
- Invalid swagger for "properties" under "definitions" breaks defintions display and validation HOT 7
- Patch method unreliable? HOT 2
- Read-only Columns HOT 2
- Flask-SQLAlchemy weakref KeyError
- in version 3.0 _s_count function does not apply filters to query HOT 1
- `count` property value is wrong for `GET` methods HOT 1
- Unable to delete entries HOT 5
- overriding methods does not work HOT 2
- extend API with custom classes HOT 1
- requirements.txt too restrictive HOT 1
- Duplicate definitions generated HOT 5
- safrs doesn't work in python 3.9 - TypeError HOT 4
- expose_existing starts but no swagger.json found HOT 1
- Run in example demo_relationship.py creating users or books in flask_admin returns Integrity Errors HOT 17
- Doubts about SAFRS HOT 2
- JSONAPI relationship missing in the swagger documentation HOT 4
- Swagger generation removing plurals HOT 1
- Flask 2.0 / Flask-restful "ImportError: cannot import name '_endpoint_from_view_func'" HOT 1
- Possible issue with BIGINT primary keys? HOT 5
- Make many to many relationship methods extendable HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from safrs.