graphql-engine/server/tests-py/queries/endpoints/endpoint_empty_path_segment.yaml
Antoine Leblanc 83045a4459 server: fix erroneous Eq instance on Metadata Object
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
2021-07-20 14:24:45 +00:00

33 lines
791 B
YAML

description: Tries to create an endpoint with empty path component
url: /v1/query
status: 400
response:
internal:
- definition:
definition:
query:
collection_name: test_collection
query_name: simple_query
url: foo//bar
methods:
- GET
name: foo
comment:
reason: "Empty segments or unnamed variables are not allowed: foo//bar"
name: endpoint foo
type: endpoint
path: $.args
error: 'Empty segments or unnamed variables are not allowed: foo//bar'
code: invalid-configuration
query:
type: create_rest_endpoint
args:
url: "foo//bar"
name: foo
methods:
- GET
definition:
query:
collection_name: test_collection
query_name: simple_query