Closed nrbnlulu closed 1 month ago
This pull request adds support for using raw Python enum types in Strawberry schemas without requiring the @strawberry.enum
decorator. The changes primarily affect the enum handling in the Strawberry library, allowing for more flexible use of enum types from external sources.
Change | Details | Files |
---|---|---|
Added support for raw Python enum types in schemas |
|
tests/enums/test_enum.py strawberry/annotation.py |
Added release notes for the new feature |
|
RELEASE.md |
Thanks for adding the RELEASE.md
file!
Here's a preview of the changelog:
This release adds support for using raw Python enum types in your schema
(enums that are not decorated with @strawberry.enum
)
This is useful if you have enum types from other places in your code that you want to use in strawberry. i.e
# somewhere.py
from enum import Enum
class AnimalKind(Enum):
AXOLOTL, CAPYBARA = range(2)
# gql/animals
from somewhere import AnimalKind
@strawberry.type
class AnimalType:
kind: AnimalKind
Here's the tweet text:
π Release (next) is out! Thanks to Χ ΧΧ¨ for the PR π
Get it here π https://strawberry.rocks/release/(next)
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 96.94%. Comparing base (
596461b
) to head (d0a0a84
). Report is 1 commits behind head on main.
Comparing nrbnlulu:default-enums
(d0a0a84) with main
(596461b)
β
15
untouched benchmarks
@erikwrede you mean the failing test, right?
@patrick91 i just meant the wrong file @nrbnlulu mentioned but looks good now π
Description
Types of Changes
Issues Fixed or Closed by This PR
fix #3543
Checklist
Summary by Sourcery
Add support for using raw Python enum types in schemas, enabling the use of enums without
@strawberry.enum
decoration. Fix issue #3543 and update tests to cover the new functionality. Document the changes in RELEASE.md.New Features:
@strawberry.enum
to be used.Bug Fixes:
Documentation:
Tests: