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

graphene/docs/execution/queryvalidation.rst missing usage example #1371

Closed
reubenosborne1 opened this issue Sep 22, 2021 · 6 comments · Fixed by #1376
Closed

graphene/docs/execution/queryvalidation.rst missing usage example #1371

reubenosborne1 opened this issue Sep 22, 2021 · 6 comments · Fixed by #1376
Labels

Comments

@reubenosborne1
Copy link

reubenosborne1 commented Sep 22, 2021

From graphene/docs/execution/queryvalidation.rst

Usage
Here is how you would implement depth-limiting on your schema.

Is missing a link or example code

@aryaniyaps
Copy link
Contributor

@reubenosborne1 I had actually added a couple of examples, but I think that it isnt rendering because of incorrect formatting. We have to make space between codefences in that file, I'll try to do it when I get time this week.

@reubenosborne1
Copy link
Author

Great thank you @codebyaryan. I can see that graphene.validation only exists in master, when do you think it will make it into a tagged release?

@aryaniyaps
Copy link
Contributor

Great thank you @codebyaryan. I can see that graphene.validation only exists in master, when do you think it will make it into a tagged release?

I am not a maintainer here, hence I dont have release access. I think that we should ask @syrusakbary or @jkimbo regarding this! :)

@reubenosborne1
Copy link
Author

reubenosborne1 commented Sep 29, 2021

Ok thank you @codebyaryan!

I have tried to run your example of depth limiting validation but I am getting the following error:

    raise TypeError(f"Expected {inspect(schema)} to be a GraphQL schema.")
TypeError: Expected <Schema instance> to be a GraphQL schema.

Any ideas what is wrong?

@aryaniyaps
Copy link
Contributor

I've now fixed it, please take a look at the changed files in the PR!

@reubenosborne1
Copy link
Author

@codebyaryan just a quick note on this...
I am using
validation_errors = validate( schema=schema.graphql_schema, document_ast=parse('Some Query'), rules=( depth_limit_validator( max_depth=2 ), ) )
as specified in the docs. But now the query has to be parsable due to parse('Some Query'), so you dont get the same errors raised if it cannot be parsed.
Any thoughts on this?

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

Successfully merging a pull request may close this issue.

2 participants