WebAPIError and APIQueryUtilsMixin for GraphQL API endpoint
Review Request #12228 — Created April 8, 2022 and discarded — Latest diff uploaded
Add a new
WebAPIErrorandAPIQueryUtilsMixinfor 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.GETobject, and GraphQL does not support hyphens in its SDL. The existingAPIQueryUtilsMixinmethod for filteringintfields does not support GraphQL requests. Additionally, it will be helpful for users to be returned aWebAPIErrorspecific to the GraphQL endpoint when an error in their request occurs.This change introduces a new
APIQueryUtilsMixinthat allows callers to filter results through aquery_paramsvariable defined in the GRaphQL request. It also creates a newWebAPIErrorthat will be returned by the GraphQL endpoint when a query fails validation.
Added unit tests for the new
build_graphql_queries_for_int_fieldmixin.
Ran all other tests intest_apiqueryutilsmixin.py.
Ran and manually tested locally that the GraphQL Validation error is returned.