WebAPIError and APIQueryUtilsMixin for GraphQL API endpoint

Review Request #12228 — Created April 8, 2022 and updated — Latest diff uploaded

Information

Djblets
master

Reviewers

Add a new WebAPIError and APIQueryUtilsMixin for use by the GraphQL API endpoint.

There are some differences in how query parameters get passed in a request between the RESTful and GraphQL API endpoints. Namely, the query parameters don't exist in the request.GET object, and GraphQL does not support hyphens in its SDL. The existing APIQueryUtilsMixin method for filtering int fields does not support GraphQL requests. Additionally, it will be helpful for users to be returned a WebAPIError specific to the GraphQL endpoint when an error in their request occurs.

This change introduces a new APIQueryUtilsMixin that allows callers to filter results through a query_params variable defined in the GRaphQL request. It also creates a new WebAPIError that will be returned by the GraphQL endpoint when a query fails validation.

Added unit tests for the new build_graphql_queries_for_int_field mixin.
Ran all other tests in test_apiqueryutilsmixin.py.
Ran and manually tested locally that the GraphQL Validation error is returned.

Commits

Files

    Loading...