mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-16 09:51:59 +03:00
83045a4459
During the "generalization" of the code, we removed the [generated instances](9d63187803 (diff-7b8382ab20e441fa214586be491eb6f7ca904d8b20ed97894c16a339be45219aL72)
) of `Eq` and `Hashable` in favour of manually written ones, because for a time we were struggling with `AnyBackend`.
In the process, we lost one constructor, `MOEndpoint`. It's unlikely to have ever been an issue, since duplicate endpoints are unlikely, but it is nonetheless wrong.
This PR simply goes back to default derived instances, now that we can, fixing the problem and making the code simpler.
---
However, after filing this PR, I realized **it broke rest endpoint tests**. Upon closer inspection, it turns out that while we had proper checks in place, because of this bug we were actually failing _differently_ during metadata checks. This PR actually improves error messages for invalid endpoint configurations?! 🙀
This is a tiny bit scary. ^^'
https://github.com/hasura/graphql-engine-mono/pull/1762
GitOrigin-RevId: c4897d1f3ae92d18c44c87d2f58258c66f716686
62 lines
1.6 KiB
YAML
62 lines
1.6 KiB
YAML
description: Add a conflicting endpoint
|
|
url: /v1/query
|
|
status: 400
|
|
response:
|
|
internal:
|
|
- reason: 'Ambiguous URL paths: :conflicting, simple, simple_cached, with_arg, with_args'
|
|
conflicts:
|
|
- definition:
|
|
query: query { test_table { first_name last_name } }
|
|
url: :conflicting
|
|
methods:
|
|
- GET
|
|
name: conflicting
|
|
comment:
|
|
- definition:
|
|
query: query { test_table { first_name last_name } }
|
|
url: simple
|
|
methods:
|
|
- GET
|
|
name: simple
|
|
comment:
|
|
- definition:
|
|
query: 'query @cached(ttl: 5) { test_table { first_name last_name } }'
|
|
url: simple_cached
|
|
methods:
|
|
- GET
|
|
name: simple_cached
|
|
comment:
|
|
- definition:
|
|
query: 'query ($first_name:String!) { test_table(where: {first_name: { _eq:
|
|
$first_name } }) { first_name last_name } }'
|
|
url: with_arg
|
|
methods:
|
|
- GET
|
|
- POST
|
|
name: with_arg
|
|
comment:
|
|
- definition:
|
|
query: 'query ($first_name: String!, $last_name:String!) { test_table(where:
|
|
{first_name: { _eq: $first_name } last_name: { _eq: $last_name }}) { first_name
|
|
last_name } }'
|
|
url: with_args
|
|
methods:
|
|
- GET
|
|
name: with_args
|
|
comment:
|
|
path: $.args
|
|
error: 'Ambiguous URL paths: :conflicting, simple, simple_cached, with_arg, with_args'
|
|
code: invalid-configuration
|
|
query:
|
|
type: create_rest_endpoint
|
|
args:
|
|
url: ":conflicting"
|
|
name: conflicting
|
|
methods:
|
|
- GET
|
|
definition:
|
|
query:
|
|
collection_name: test_collection
|
|
query_name: simple_query
|
|
|