If you try to make a strawberry type from a pydantic class but mask out one of the fields in the pydantic class by making it private, it produces a key error.
class MyPydanticClass(BaseModel):
a_field: int
b_field: int
@strawberry.experimental.pydantic.type(model=NewVrmOrder
class MyStrawberryClass(model=MyPydanticClass):
a_field: strawberry.auto
b_field: strawberry.Private[int]
Traceback (most recent call last):
File ".../example.py", line 11, in
class MyStrawberryClass:
File ".../python3.8/site-packages/strawberry/experimental/pydantic/object_type.py", line 175, in wrap
all_model_fields: List[DataclassCreationFields] = [
File ".../python3.8/site-packages/strawberry/experimental/pydantic/object_type.py", line 176, in
_build_dataclass_creation_fields(
File ".../python3.8/site-packages/strawberry/experimental/pydantic/object_type.py", line 63, in _build_dataclass_creation_fields
else existing_fields[field.name].type
KeyError: 'b_field'
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too