-
Notifications
You must be signed in to change notification settings - Fork 303
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix includes end excludes for subresources #424
Conversation
Oops, sorry. The build has failed. |
it's bug cause the the update of sqlalchemy1.0.2 |
I think there is no need for this pull request currently. I figured out that with current implementation we loose the ability to create multiple endpoints for one resource via For example, you have a Then you create an endpoint for It may seem to be OK to use something else from And that's a big deal. I even not sure if this can be resolved or resolved without major architectural changes. Please, tell me if you have some thoughts on this. |
Oh, thank you. It's getting a bit complicated. I need some time to think about this and see what can be done. |
…ROUP BY and ORDER BY
Well, I've thought about this a little. First of all, I'll need to remove last commits from this pull request and extract some of them into separate pull requests or just to create a new one. Second, it seems to be Ok the following idea: instead of guessing on something it's better to set things explicitly. And here is what I mean. I suppose it will be OK to allow user to pass Currently we can create serializers using
And then we will be able to use it:
The cool thing about this is that we can extract serializers into a separate module and then reuse them. And not only for views. And this is really great. This leads us to the following idea: we can define a mapping
Or we can define an universal parameter for setting up
In case ResouceA has some ResourceX as subresource and Please, let me know about your thoughts on that. It will be cool if we can communicate in some more direct way, e.g. via Skype, Gitter.im or so. |
sorry, i'm busy these days. |
On the master branch, the correct serializers are now called for each type of resource; see http://flask-restless.readthedocs.org/en/latest/customizing.html#per-model-serialization If you can't solve your problem using that, please open a new issue, as the code has recently changed significantly. Thanks! |
Hello!
I have experienced same problem as described at #211.
That issue tells that if we have API like
/resource/<:id>/subresource
then all fields ofsubresource
are exposed. It seems like includes and excludes which were defined forsubresource
are not applied.However, the problem is more complicated. Actually, what we have is that includes and excludes of
resource
are applied forsubresource
. This is a terrible issue, becauseto_dict
can try to include fields/methods/relations which are not defines forsubresource
. And this will just result into HTTP 500.This patch resolves the issue. I'm not sure this is done in a perfect way, so we can make a discussion if needed.