-
Notifications
You must be signed in to change notification settings - Fork 227
Add a meta option to allow field names renaming #178
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
Add a meta option to allow field names renaming #178
Conversation
Existing tests were not covering lines I've edited and I admit I don't know how to test its (I don't know what are composite fields and hybrid fields) If someone want to help me on that, it's with pleasure ;) |
99299c1
to
a70f254
Compare
Nice. This might be useful when you can't change the SQLAlchemy model or are using reflection. But maybe the name "aliased_fields" is a bit misleading, because an alias is usually an alternative, additional name that exists parallel to the original name, but what you're doing is renaming the fields. Also, the other attributes use the imperative form "skip_", "use_", "exclude_", instead of "skipped_", "used_", "exclude_". So to be more clear and consistent I suggest the name "rename_fields" instead. Btw, to answer your question above, composite fields and hybrid fields are rarely used concepts of SQLAlchemy. Composite fields allow you to pack multiple columns into one field, and hybrid attributes can act on both the instance and class level. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See the inline comments and the comment above regarding the name. Otherwise looks fine to me.
a70f254
to
ec8afb5
Compare
Closing this since it is now possible to rename fields via |
Example is given in the README.md and in tests
It allows to implement :
To be able to have a field named
first_name
in your graphql schema instead of being stucked with UserModel field namename