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

Migration to graphql-core-v3 #36

Merged
merged 17 commits into from
Apr 12, 2020

Conversation

KingDarBoja
Copy link
Contributor

@KingDarBoja KingDarBoja commented Mar 17, 2020

Based on @Cito branch as stated at #20 and as part of the refactoring and merge steps discussed at the Slack channel plus #34, this PR aims to make graphql-server compatible with latest graphql-core version.

@jkimbo this one is ready for review!

Copy link
Member

@jkimbo jkimbo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks fantastic thanks @KingDarBoja ! Couple of questions around why some tests were removed though.

tests/test_asyncio.py Show resolved Hide resolved
tests/test_helpers.py Outdated Show resolved Hide resolved
@KingDarBoja KingDarBoja requested a review from jkimbo April 6, 2020 22:42
@KingDarBoja
Copy link
Contributor Author

KingDarBoja commented Apr 7, 2020

Ummm, so weird, the re-added tests didn't passed although those did locally.

EDIT Fixed both tests because missing period on the graphql-core error message (which got fixed on v3.1.0).

@KingDarBoja
Copy link
Contributor Author

@jkimbo I have no idea what's going on but removing the @mark.asyncio on the asyncio test will make it pass 🤔

Copy link
Member

@jkimbo jkimbo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good @KingDarBoja . Minor change needed regarding the graphql-server dependency but other than that I think this is good to merge.

@jkimbo I have no idea what's going on but removing the @mark.asyncio on the asyncio test will make it pass 🤔

I think that makes sense because the pytest asyncio library assumes the function that is wrapping is an async function but the tests here create an async function inside the body and then wait for it resolve. We might need to add the pytest asyncio library back again in the future if we end up writing lots more async tests but we can cross that bridge when we come to it.

setup.py Outdated Show resolved Hide resolved
@KingDarBoja KingDarBoja requested a review from jkimbo April 12, 2020 16:49
Copy link
Member

@jkimbo jkimbo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@KingDarBoja KingDarBoja merged commit 865ee9d into graphql-python:master Apr 12, 2020
@KingDarBoja KingDarBoja self-assigned this Apr 12, 2020
@KingDarBoja KingDarBoja added type: maintenance An issue or pull request describing a change that isn't a bug, feature or documentation change type: chore Changes to the build process or auxiliary tools and libraries such as documentation generation labels Apr 12, 2020
"errors": [{"msg": "Some msg", "loc": "1:2", "pth": "some/path"}],
}
assert output.status_code == 200
assert output.status_code == 400

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems like a subtly nontrivial change... if existing clients expect an HTTP 200 even if the errors key is present in the response, won't this potentially break them? Personally, I prefer this behavior, but it seems risky to change outright and I don't see anything that mentions the rationale for doing so.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good spot @wyattanderson ! @KingDarBoja can we revert the change to return a 400 status code if the response contains errors? We should always return with a 200 because there might be partial data returned.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes were made at these lines so should be easier to revert.

I do prefer the 400 status code as it reflects there was an error on the request but I didn't took into account the possible side effects for those clients than expect a HTTP 200 response.

Maybe we can keep the new behaviour and put on the readme a Breaking Change Note about this as this will be part of graphql-server-core v3.

@KingDarBoja KingDarBoja deleted the migrate-graphql-core-v3 branch April 13, 2020 17:11
@KingDarBoja KingDarBoja mentioned this pull request Apr 26, 2020
@jkimbo jkimbo mentioned this pull request May 10, 2020
@KingDarBoja KingDarBoja linked an issue Jul 5, 2020 that may be closed by this pull request
@KingDarBoja KingDarBoja added this to the GraphQL-Server (V3) milestone Jul 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: chore Changes to the build process or auxiliary tools and libraries such as documentation generation type: maintenance An issue or pull request describing a change that isn't a bug, feature or documentation change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

New version using graphql-core-next instead of graphql-core
4 participants