Experimantal GraphQL Endpoint
Review Request #12036 — Created Feb. 4, 2022 and discarded — Latest diff uploaded
Add an experimental GraphQL API endpoint.
This change introduces a new endpoint at
/graphql
, which handles GraphQL requests. The endpoint accepts POST requests with the body containing a valid GraphQL query. The schema for the API is generated by functions that map existingWebAPIResource
's into GraphQL types. This change also includes the query resolvers, which are called by thepy-gql
functiongraphql_blocking
, that query, filter, and return data from the database. Currently, only theUser
andReviewRequest
objects have been defined in the schema and have resolvers.The filtering logic in
resolve_review_requests
uses essentially the same logic as the filtering in thereview_request
resource, with some slight changes due to the difference in GrapgQL schema and REST query parameters. Ideally, this code would be refactored and DRY'ed out. Additionally, when building the schema we may eventually want to define theResourceList
andResource
types as a nested type, to take full advantage of the technology. For now, these are typed as objects withhref
,method
, andtitle
as they currently are in the other API resources.
Added unit tests for
GraphQLResource
and theUser
,Users
,ReviewRequest
, andReviewRequests
resolvers.
Ran allreviewboard
tests.