-------------------
Adds support for `use_pydantic_alias` parameter in pydantic model conversion.
Decides if the all the GraphQL field names for the generated type should use the alias name or not.
python
from pydantic import BaseModel, Field
import strawberry
class UserModel(BaseModel):
id: int = Field(..., alias="my_alias_name")
strawberry.experimental.pydantic.type(UserModel, use_pydantic_alias=False)
class User:
id: strawberry.auto
If `use_pydantic_alias` is `False`, the GraphQL type User will use `id` for the name of the `id` field coming from the Pydantic model.
type User {
id: Int!
}
With `use_pydantic_alias` set to `True` (the default behaviour) the GraphQL type user will use `myAliasName` for the `id` field coming from the Pydantic models (since the field has a `alias` specified`)
type User {
myAliasName: Int!
}
`use_pydantic_alias` is set to `True` for backwards compatibility.
Contributed by [James Chua](https://github.com/thejaminator) [PR #1546](https://github.com/strawberry-graphql/strawberry/pull/1546/)