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

Add Checks for Operation Definition in GraphQL Query #18

Merged
merged 4 commits into from
Jun 20, 2024

Conversation

desout
Copy link
Contributor

@desout desout commented May 24, 2024

This PR addresses missing checks for operation definitions in GraphQL queries.

Changes include:

  1. Added condition to check if definition name is present then insert it into the props vector.
  2. For cases where no operation type is provided, it defaults to "query".
  3. Added logic to create all_definitions vector, and a check for presence of more than one definition. In case where a name is absent for any of these definitions, an appropriate error is thrown.

Lay the groundwork for further validation checks in GraphQL query processing based on the behavior of 'gajus/babel-plugin-graphql-tag' project.

While extensive testing has been done locally, it has not been fully covered by automated tests due to Rust experience constraints. Specifically, error/panic scenarios demand more test coverage.

This effort has mimicked necessary logic from an existing solution found at https://github.com/gajus/babel-plugin-graphql-tag/blob/master/test/fixtures/graphql-tag. The current changes seek to ensure similar, comprehensive validation checks in Rust implementation.
#21

@desout desout changed the title fixed 2 cases with unnamed operation and query Add Checks for Operation Definition in GraphQL Query May 29, 2024
@desout
Copy link
Contributor Author

desout commented May 31, 2024

@rishabh3112 Hello, could you, please, take a look on this changes?

@rishabh3112
Copy link
Owner

@desout Thanks for PR! Left few comments.

@desout
Copy link
Contributor Author

desout commented Jun 11, 2024

@rishabh3112 Hello, Where i can check your comments? :)

@desout
Copy link
Contributor Author

desout commented Jun 11, 2024

@rishabh3112 Please review

@rishabh3112
Copy link
Owner

@desout will check and merge this weekend, thanks for contributions! Also, can you please change commits by using same email address as you have with github account? (for clearer commit history)

@desout
Copy link
Contributor Author

desout commented Jun 13, 2024

@rishabh3112 Updated commits with proper email

@rishabh3112 rishabh3112 merged commit effac58 into rishabh3112:master Jun 20, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants