graphql-engine/server/tests-py/queries/remote_schemas
Antoine Leblanc 81d9071948 Fix remote relationship invalid type name issue (fix hasura/graphql-engine#8002)
## Description

When setting up a remote relationship to a remote schema, values coming from the left-hand side are given as _arguments_ to the targeted field of the remote schema. In turn, that means we need to adjust the arguments to that remote field; in the case of input objects, it means creating a brand new input object in which the relevant fields have been removed.

To both avoid conflicts, and be explicit, we give a pretty verbose name to such an input object: its original name, followed by "remote_rel", followed by the full name of the field (table name + relationship name). The bug there was introduced when working on extending remote relationships to other backends: we changed the code that translates the table name to a graphql identifier to be generic, and use the table's `ToTxt` instance instead. However, when a table is not in the default schema, the character used by that instance is `.`, which is not a valid GraphQL name.

This PR fixes it, by doing two things:
- it defines a safe function to translate LHS identifiers to graphql names (by replacing all invalid characters by `_`)
- it doesn't use `unsafeMkName` anymore, and checks at validation time that the type name is correct

## Further work

On this PR:
- [x] add a test
- [x] write a Changelog entry

Beyond this PR, we might want to:
- prioritize #1747
- analyze all calls to `unsafeMkName` and remove as many as possible

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3363
GitOrigin-RevId: fe98eb1d34157b2c8323af453f5c369de616af38
2022-01-27 14:34:01 +00:00
..
permissions Fix remote relationship invalid type name issue (fix hasura/graphql-engine#8002) 2022-01-27 14:34:01 +00:00
remote_relationships Fix remote relationship invalid type name issue (fix hasura/graphql-engine#8002) 2022-01-27 14:34:01 +00:00
validation Fix for customized remote schema input object types in query variables 2022-01-24 04:46:46 +00:00
add_remote_schema_err_missing_arg.yaml Remote Schema Customization take 2 using parser tranformations 2021-07-30 11:33:59 +00:00
add_remote_schema_err_missing_field.yaml support union and interface types in remote schema (close #1276) (#1361) 2019-01-28 22:15:10 +05:30
add_remote_schema_err_unknown_interface.yaml support union and interface types in remote schema (close #1276) (#1361) 2019-01-28 22:15:10 +05:30
add_remote_schema_iface_err_wrong_arg_type.yaml support union and interface types in remote schema (close #1276) (#1361) 2019-01-28 22:15:10 +05:30
add_remote_schema_with_iface_err_empty_fields_list.yaml support union and interface types in remote schema (close #1276) (#1361) 2019-01-28 22:15:10 +05:30
add_remote_schema_with_iface_err_extra_non_null_arg.yaml support union and interface types in remote schema (close #1276) (#1361) 2019-01-28 22:15:10 +05:30
add_remote_schema_with_iface_err_wrong_field_type.yaml support union and interface types in remote schema (close #1276) (#1361) 2019-01-28 22:15:10 +05:30
add_remote_schema_with_union_err_member_type_interface.yaml support union and interface types in remote schema (close #1276) (#1361) 2019-01-28 22:15:10 +05:30
add_remote_schema_with_union_err_no_member_types.yaml support union and interface types in remote schema (close #1276) (#1361) 2019-01-28 22:15:10 +05:30
add_remote_schema_with_union_err_unknown_types.yaml support union and interface types in remote schema (close #1276) (#1361) 2019-01-28 22:15:10 +05:30
add_remote_schema_with_union_err_wrapped_type.yaml Rewrite GraphQL schema generation and query parsing (close #2801) (#4111) 2020-08-21 12:27:01 -05:00
basic_bulk_remove_add.yaml implement internal graphql server for remote schema tests (#1117) 2018-11-26 18:38:16 +05:30
basic_query_customized.yaml Test customization with update_remote_schema 2021-08-02 05:50:49 +00:00
basic_query.yaml introduce v1/graphql (fix #1368) (#2064) 2019-05-10 11:35:10 +05:30
basic_subscription_not_supported.yaml introduce v1/graphql (fix #1368) (#2064) 2019-05-10 11:35:10 +05:30
basic_timeout_query.yaml server: improve handling of HTTP client errors for remote schema calls 2021-07-07 10:15:05 +00:00
character_interface_query.yaml introduce v1/graphql (fix #1368) (#2064) 2019-05-10 11:35:10 +05:30
check_resp_headers.yaml forward set-cookie headers from remote servers (fix #1654) (#2305) 2019-06-04 15:40:28 +05:30
create_conflicting_table.yaml implement internal graphql server for remote schema tests (#1117) 2018-11-26 18:38:16 +05:30
drop_person_table.yaml merge types with same structure in remote schema (closes #1112, #1135) (#1145) 2018-12-12 17:31:18 +05:30
drop_user_table.yaml server: support separate metadata database and server code setup for multi sources (#197) 2020-12-28 12:56:55 +00:00
person_table.yaml fix conversion when merging remote schema scalars with hasura (fix #1244) (#1497) 2019-01-28 21:01:37 +05:30
search_union_type_query.yaml introduce v1/graphql (fix #1368) (#2064) 2019-05-10 11:35:10 +05:30
simple2_mutation.yaml Fix result ordering in some incorrect tests 2019-11-05 15:15:25 -06:00
simple2_query.yaml Fix result ordering in some incorrect tests 2019-11-05 15:15:25 -06:00
tbls_setup.yaml [server] coalesce multiple run_sql calls in tests (#270) 2021-01-06 16:07:22 +00:00
tbls_teardown.yaml implement internal graphql server for remote schema tests (#1117) 2018-11-26 18:38:16 +05:30