Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Required/NonNull parameters do not work #1394

Closed
Tomms93 opened this issue Dec 7, 2021 · 5 comments
Closed

Required/NonNull parameters do not work #1394

Tomms93 opened this issue Dec 7, 2021 · 5 comments
Labels

Comments

@Tomms93
Copy link

Tomms93 commented Dec 7, 2021

Required=True and NonNull parameters do not work in Query.
I have tried 3 following ways:
hello2 = String(name=String(required=True))
hello2 = String(name=NonNull(String))
hello2 = String(name=Argument(String, required=True))

with following resolver:
def resolve_hello2(root, info, name):
return f"Hello {name}!"

And in any of these ways, when I do not provide name, I do not get any error:

image

Although playground seems to recognize that 'hello2' need some parameters, because it is underlined, where 'hello' is not (it does not have any mandatory parameters):

image

Graphene version:
graphene 3.0
graphql-core 3.1.6
graphql-relay 3.1.0

Running API using starlette_graphene3:
starlette-graphene3 0.5.1

Also tested running API using starlette.graphql - the same behavior.

Python: 3.8.10

@stabacco
Copy link

stabacco commented Jan 5, 2022

I am seeing the same behavior.

tcleonard pushed a commit to loft-orbital/graphene that referenced this issue Mar 20, 2022
tcleonard pushed a commit to loft-orbital/graphene that referenced this issue Mar 20, 2022
tcleonard pushed a commit to loft-orbital/graphene that referenced this issue Mar 20, 2022
tcleonard added a commit to loft-orbital/graphene that referenced this issue Mar 20, 2022
fix: default value for argument should be Undefined (Issue graphql-python#1394)
tcleonard added a commit to loft-orbital/graphene that referenced this issue Mar 20, 2022
fix: default value for argument should be Undefined (Issue graphql-python#1394)
@rarenatoe
Copy link

Same behavior here. Shameless bump.

@tcleonard
Copy link
Collaborator

was solved by PR #6

@flipbit03
Copy link
Contributor

flipbit03 commented May 2, 2022

@tcleonard just a heads up. I think this PR link is pointing to wrong stuff (2015/2017 discussion).

I had the same bug as the people above as well, here's my setup:

graphene==3.0
graphene-pydantic==0.3.0
graphql-core==3.1.7
graphql-relay==3.1.5
starlette-graphene3==0.5.1

I'm changing to graphene from master to see if this alleviates the problem

EDIT: Problem is fixed installing straight from master, commit hash 03277a55123fd2f8a8465c5fa671f7fb0d004c26

@tcleonard
Copy link
Collaborator

This was released in graphene >=3.1 so it's normal you still get it if you are using versions below that

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants