You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to generate a client for a server that has a special format of the ID scalar, which I want to parse into a custom type in the result model. I've tried to override the str type with Custom scalars, but it works only for the client function argument, not for the result type. I've added a simplified sample at the end of the issue for illustration.
Upon further investigation, I found the code responsible for generating annotations for result models. It appears that the reason for this issue is that in the parse_scalar_type function, the type is checked against SIMPLE_TYPE_MAP first, and custom_scalars aren't used with built-in scalar types. Swapping the first two if statements in this function fixes the issue for me.
So my questions are:
Is this behavior by design, or would you consider a PR with the fix for this?
If this is by design, could someone point me to ways of achieving this?
Hi,
I'm trying to generate a client for a server that has a special format of the
ID
scalar, which I want to parse into a custom type in the result model. I've tried to override thestr
type with Custom scalars, but it works only for the client function argument, not for the result type. I've added a simplified sample at the end of the issue for illustration.Upon further investigation, I found the code responsible for generating annotations for result models. It appears that the reason for this issue is that in the parse_scalar_type function, the type is checked against
SIMPLE_TYPE_MAP
first, andcustom_scalars
aren't used with built-in scalar types. Swapping the first two if statements in this function fixes the issue for me.So my questions are:
Example
schema.graphql
queries.graphql
pyproject.toml
client.py
get_user_by_id.py
The text was updated successfully, but these errors were encountered: