-
-
Notifications
You must be signed in to change notification settings - Fork 27
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
feature: map sqlalchemy doc attribute to strawberry fields #203
base: main
Are you sure you want to change the base?
feature: map sqlalchemy doc attribute to strawberry fields #203
Conversation
Reviewer's Guide by SourceryThis pull request adds support for mapping SQLAlchemy doc attributes to Strawberry fields' descriptions. It also introduces the ability to set a description for the entire Strawberry type. These changes enhance the generated GraphQL schema by providing more detailed information about types and fields. Updated class diagram for the mapper classclassDiagram
class Mapper {
+_add_annotation(type_: Any, key: str, annotation: Any, generated_field_keys: List[str], field_description: str = None)
+type(model: Type[BaseModelType], make_interface: bool = false, use_federation: bool = false, description: str = None) -> Callable[[Type[object]], Any]
}
note for Mapper "Added field_description parameter to _add_annotation and description parameter to type method"
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
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.
Hey @YovelB98 - I've reviewed your changes and they look great!
Here's what I looked at during the review
- 🟢 General issues: all looks good
- 🟢 Security: all looks good
- 🟡 Testing: 1 issue found
- 🟢 Complexity: all looks good
- 🟡 Documentation: 2 issues found
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
@patrick91 @bellini666 May you please have a look on this one when you have time? Pretty small feature/fix that benefits great value |
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.
Hey, thanks for the PR! I'd prefer us to make this configurable. While some use cases of this library are very close to the database schema, including docstrings, we'd want to avoid a situation that accidentally exposes internal docs, especially for existing solutions. This is in line with the decision we've taken over at the core strawberry library. Once we have some confogurability, I'm positive we could make this a feature.
Description
Types of Changes
Issues Fixed or Closed by This PR
Checklist
Summary by Sourcery
Introduce a feature to map SQLAlchemy column 'doc' attributes to Strawberry field descriptions, enhancing the integration between SQLAlchemy and Strawberry GraphQL. Update tests to ensure this mapping works correctly and document the change in the release notes.
New Features:
Documentation:
Tests: