graphql-engine/server/tests-py/queries/endpoints
Antoine Leblanc b4f7e96665 Rewrite GraphQL.Analysis
### Motivation

While we strive to write clear code, we have historically struggled at Hasura with having very different styles and standards across the codebase. There's been efforts to standardize our coding style, we have an official styleguide that isn't maintained as closely as it should... We still have some work in front of us.

However, in the last ~year or so, there's been a huge push towards incrementally improving the situation. As part of this we've been blocking PRs that don't add enough comments, or don't improve the files that they touch.

While looking at `Hasura.GraphQL.Analyse`, it became apparent that this file did not meet the engineering standards that I would expect to see addressed during a code review. Some ways in which I think it falls short:
- lack of documentation
- no clear distinction between public / internal components
- "unidiomatic" Haskell code (such as using `Either Result Error`)

While there's no problem with a file looking like this during development, those issues should have been caught at review time. The fact that they weren't indicates a problem in our process that we will need to address: code quality and maintainability is paramount, and we all need to do our part.

### Description

This PR rewrites all of `Hasura.GraphQL.Analyze`, and adapts `Hasura.Server.OpenAPI` accordingly where needed. I've attempted to clarify names and add documentation based on my understanding of the code, and to clean what was unused (such as field variables). I don't think this PR is good enough as is, and I welcome criticism where I got my comments wrong / am happy to help y'all add more.

This PR makes one small change in the way error messages are reported (and adjusts the corresponding test accordingly); each error message is now prefixed with the path within the selection set:
```
⚠️ $.test.foo.bar.baz.mizpelled: field 'mizpelled' not found in object 'Baz'
```

### Note

This PR is currently **on top of #3962**. You can preview the changes in isolation by [diffing the branches](https://github.com/hasura/graphql-engine-mono/compare/nicuveo/clean-rest-endpoint-inconsistency-check..nicuveo/rewrite-analysis).

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3963
Co-authored-by: paritosh-08 <85472423+paritosh-08@users.noreply.github.com>
GitOrigin-RevId: 5ec38e0e753f0c12096a350db0737658495e2f15
2022-04-04 05:54:59 +00:00
..
endpoint_as_user_err.yaml server: add tests ensuring the correct functioning of all endpoints based on user roles 2021-07-16 16:09:25 +00:00
endpoint_conflicting.yaml server: fix erroneous Eq instance on Metadata Object 2021-07-20 14:24:45 +00:00
endpoint_dropped.yaml server: support restified versions of graphql queries (#303) 2021-01-29 01:03:35 +00:00
endpoint_duplicate_param.yaml server: validate REST endpoint queries after metadata change 2022-02-08 04:47:52 +00:00
endpoint_empty_path_param.yaml server: validate REST endpoint queries after metadata change 2022-02-08 04:47:52 +00:00
endpoint_empty_path_segment.yaml server: validate REST endpoint queries after metadata change 2022-02-08 04:47:52 +00:00
endpoint_empty_path.yaml Inconsistent metadata support for REST endpoints 2021-03-10 05:26:10 +00:00
endpoint_missing.yaml server: support restified versions of graphql queries (#303) 2021-01-29 01:03:35 +00:00
endpoint_query_validation.yaml Rewrite GraphQL.Analysis 2022-04-04 05:54:59 +00:00
endpoint_simple_cached.yaml server: support restified versions of graphql queries (#303) 2021-01-29 01:03:35 +00:00
endpoint_simple_wrong_method.yaml server: support restified versions of graphql queries (#303) 2021-01-29 01:03:35 +00:00
endpoint_simple.yaml server: add tests ensuring the correct functioning of all endpoints based on user roles 2021-07-16 16:09:25 +00:00
endpoint_subscription.yaml server: validate REST endpoint queries after metadata change 2022-02-08 04:47:52 +00:00
endpoint_trailing_slash.yaml server: validate REST endpoint queries after metadata change 2022-02-08 04:47:52 +00:00
endpoint_with_body_arg.yaml server: support restified versions of graphql queries (#303) 2021-01-29 01:03:35 +00:00
endpoint_with_list_arg.yaml Fixing REST Enpoints list variable bug 2021-12-03 21:57:25 +00:00
endpoint_with_multiple_query_args.yaml server: support restified versions of graphql queries (#303) 2021-01-29 01:03:35 +00:00
endpoint_with_query_arg_missing_arg.yaml server: support restified versions of graphql queries (#303) 2021-01-29 01:03:35 +00:00
endpoint_with_query_arg_url_encoded_2.yaml server: support restified versions of graphql queries (#303) 2021-01-29 01:03:35 +00:00
endpoint_with_query_arg_url_encoded.yaml server: support restified versions of graphql queries (#303) 2021-01-29 01:03:35 +00:00
endpoint_with_query_arg.yaml server: support restified versions of graphql queries (#303) 2021-01-29 01:03:35 +00:00
endpoint_with_template.yaml server: support restified versions of graphql queries (#303) 2021-01-29 01:03:35 +00:00
endpoint_with_uuid_arg.yaml REST endpoint uuid param bugfix 2021-05-06 06:44:17 +00:00
setup.yaml server: add validation for query collections 2022-03-08 09:49:18 +00:00
teardown.yaml Fixing REST Enpoints list variable bug 2021-12-03 21:57:25 +00:00