Comments (6)
Okay, we were almost right.
Using dump_only=[] should work, but the following code in marshmallow:
self.dump_only = set(dump_only) or set(self.opts.dump_only)
kind of fail. Since set([]) is equal to 0, it will go with the or.
So you should just not use an empty array and do something like this for example:
users = base_fields.List(base_fields.Nested(BaseUserSchema(only=['id'], dump_only=[None])))
Not the perfect solution, but it works and keep your basic schema secured by not accepting ID rewrite.
Thank you again for the project.
from flask-restplus-server-example.
I would create a separate schema for user IDs.
from flask-restplus-server-example.
Okay, seems a bit overkill to me to have something like:
class UploadUserSchema(ModelSchema):
class Meta:
model = User
fields = (
User.id.key,
)
for every schema?
Can't we override the dump_only with only=['id'] for example?
from flask-restplus-server-example.
Have you tried to pass an empty list to dump_only
?
users = base_fields.List(base_fields.Nested(BaseUserSchema(only=['id'], dump_only=[])))
from flask-restplus-server-example.
I just tried, not working. Apparently it is not overriding the dump_only from Meta class.
from flask-restplus-server-example.
I am sorry, I won't be able to help you with this.
from flask-restplus-server-example.
Related Issues (20)
- Werkzeug version is incompatible HOT 2
- [QUESTION] How can i work with SQLALCHEMY_BINDS? HOT 2
- How Can I Disable OAuth2 Module? HOT 2
- How to display Chinese in API Response? HOT 2
- How can add my model in API for this flame? HOT 1
- How to implement filter query request for the framework? HOT 4
- How can use Mysql DB Instead Sqlite? HOT 2
- How to run the application as a service? HOT 1
- How can to custom json response for this project? HOT 3
- [QUESTION] Best place to implement implement expanding of returned objects/schema's HOT 2
- why the project backend run failed on linux(centos7) ? HOT 4
- How can I upload or update a file field? HOT 1
- [Question] Oauth: How to use other Oauth system? HOT 2
- How can you use schemas in this project with celery HOT 4
- File upload works as documented, but SPA's also can upload file's via JSON in body HOT 1
- Porting to Flask-RESTX? HOT 1
- Question: what is suggested way to add endpoints to respond web pages ? HOT 2
- ModuleNotFoundError: No module named 'config' HOT 1
- Unable to build docker image from Dockerfile 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 flask-restplus-server-example.