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
Negative interface matching? #41
Comments
Hm, what if somebody does something like, |
What about an option to specify default exclusions on the model itself, it would remove some of the interface copy pasta when doing joins. Obviously that still leaves syntax about when you do want to include it |
So my initial implementation had developers defining "default interfaces" on the Model, which was default inclusions. I removed it because it's combining view logic with model logic and it becomes a pain in the ass to trace down / is easy to forget about. For now, I'd prefer to focus on a syntax just for excluded fields using |
Yeah thats a really good point about model/view logic. Personally I don't mind the current implementation, I just don't like the copy pasta in controller methods. Why not have, as you suggest, My only thought is would that be obvious to people. For example using the twitter/user stuff from the videos, would people understand this shows everything but password from both models
|
I do not like the idea of the interface being exclusionary instead of inclusionary. It should be inclusionary by default, it's easier to reason about. Perhaps Does that sound reasonable? Then we can just add another parameter to |
Works for me |
Alright. I can do this --- a couple of other Model changes I want to make anyway. Will get to it this weekend. |
Yes I'm also fine with that one! 👍 Sorry for my typos, I'm writing from mobile :) |
New idea: Why not responseWithout as new method (as opposite to response)? Could that be less confusing instead of a flag? |
I'd rather just have a flag. "respondWithout" doesn't mean anything. Respond without what? Chances are a new dev would look up an API reference either way. |
Fair enough. Was just an idea. |
Supported: Must specify: Not linked up to |
Finished with fd65291 |
So instead of defining
[id, username, created_at]
as interface wouldn't it be better to do allow for the opposite and only define the things to hide?I propose thse following syntax:
['!password']
will hide the password and use all default fields. This should also work in cascade relationships like[{user: ['!password']}]
.Now I don't need to worry to keep updating the interfaces everywhere when I created or remove a field from my model.
The text was updated successfully, but these errors were encountered: