feat: use TypedDict for Python query codegen#4089
Draft
magicmark wants to merge 1 commit intostrawberry-graphql:mainfrom
Draft
feat: use TypedDict for Python query codegen#4089magicmark wants to merge 1 commit intostrawberry-graphql:mainfrom
magicmark wants to merge 1 commit intostrawberry-graphql:mainfrom
Conversation
Contributor
Reviewer's GuideUpdates the Python query code generation to emit TypedDict-based result and input types (using NotRequired for optional fields with defaults), teaches schema codegen to gracefully skip custom directive definitions and improves its error messaging, and refreshes tests/docs plus adds a release note for these behaviors. File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4089 +/- ##
==========================================
- Coverage 94.22% 94.21% -0.02%
==========================================
Files 541 541
Lines 35519 35521 +2
Branches 1877 1877
==========================================
- Hits 33469 33466 -3
- Misses 1739 1747 +8
+ Partials 311 308 -3 🚀 New features to boost your workflow:
|
Change the Python query codegen plugin to generate TypedDict classes instead of plain classes. This provides better type safety for dictionary-like access patterns commonly used when working with JSON responses from GraphQL APIs. Optional fields with default values now use NotRequired instead of the = value syntax (which TypedDict doesn't support). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
11caefc to
21c18bf
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Use TypedDict for Python query codegen.
Description
🤖 Generated with Claude Code
Types of Changes
Issues Fixed or Closed by This PR
Checklist
Summary by Sourcery
Switch Python query code generation to use TypedDict-based result and input types and improve schema codegen handling of custom directives and errors.
New Features:
Enhancements:
Documentation:
Tests: