• 
      

    WebAPIError and APIQueryUtilsMixin for GraphQL API endpoint

    Review Request #12228 — Created April 8, 2022 and discarded

    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.

    Summary ID
    Add new WebAPIError for GraphQL validation error
    55a832c39e0b04a58ec156d6c0a3b87a557944dd
    Add APIQueryUtilsMixin for use by GraphQL resolvers to filter an int field
    fe4b6d3f71cecec2cf3be5f1213c8f4aa2c77d40
    Add unit tests for GraphQL query builder
    16fea59b87cdad73e9123633758d819367904954
    david
    Review request changed
    Status:
    Discarded