(feat) cli: export schema from callable#3797
Conversation
Reviewer's Guide by SourceryThis pull request introduces the ability to export a Strawberry schema from a callable function using the Sequence diagram for exporting schema from callablesequenceDiagram
participant CLI
participant utils
participant Module
participant Schema
CLI->>utils: load_schema(schema_string, app_dir)
utils->>Module: Import schema_symbol from schema_string
alt schema_symbol is callable
Module->>Module: schema_symbol()
end
Module-->>utils: schema_symbol (Schema)
utils->>Schema: isinstance(schema_symbol, Schema)
alt not isinstance(schema_symbol, Schema)
utils->>CLI: Error: schema must be an instance of strawberry.Schema
else
utils-->>CLI: Schema
end
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey @alexey-pelykh - I've reviewed your changes - here's some feedback:
Overall Comments:
- Consider adding a test case with a more complex callable, perhaps one with arguments.
Here's what I looked at during the review
- 🟡 General issues: 1 issue found
- 🟢 Security: all looks good
- 🟡 Testing: 2 issues found
- 🟢 Complexity: all looks good
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
|
Thanks for adding the Here's a preview of the changelog: This release adds support for exporting schema created by a callable: strawberry export-schema package.module:create_schemawhen def create_schema():
return strawberry.Schema(query=Query)Here's the tweet text: |
|
Thanks for adding the Here's a preview of the changelog: This release adds support for exporting schema created by a callable: strawberry export-schema package.module:create_schemawhen def create_schema():
return strawberry.Schema(query=Query)Here's the tweet text: |
f217d3d to
765e81e
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3797 +/- ##
==========================================
- Coverage 97.24% 97.23% -0.02%
==========================================
Files 503 503
Lines 33568 33581 +13
Branches 1717 1718 +1
==========================================
+ Hits 32642 32651 +9
- Misses 707 711 +4
Partials 219 219 |
CodSpeed Performance ReportMerging #3797 will not alter performanceComparing Summary
|

Description
Add support for exporting schema created by a callable:
when
Types of Changes
Issues Fixed or Closed by This PR
None that I'm aware of
Checklist
Summary by Sourcery
Adds support for exporting a schema created by a callable function using the command line interface.
New Features:
Tests: