graphql-engine/server/tests-py/queries/remote_schemas/remote_relationships
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
..
schema_customization Fix/remote nested field customization 2021-08-05 14:59:55 +00:00
basic_array_without_join_key.yaml Fix remote relationship invalid type name issue (fix hasura/graphql-engine#8002) 2022-01-27 14:34:01 +00:00
basic_array.yaml Fix remote relationship invalid type name issue (fix hasura/graphql-engine#8002) 2022-01-27 14:34:01 +00:00
basic_mixed.yaml Fix remote relationship invalid type name issue (fix hasura/graphql-engine#8002) 2022-01-27 14:34:01 +00:00
basic_multiple_fields.yaml Fix remote relationship invalid type name issue (fix hasura/graphql-engine#8002) 2022-01-27 14:34:01 +00:00
basic_nested_fields.yaml Fix remote relationship invalid type name issue (fix hasura/graphql-engine#8002) 2022-01-27 14:34:01 +00:00
basic_relationship_alias.yaml Fix remote relationship invalid type name issue (fix hasura/graphql-engine#8002) 2022-01-27 14:34:01 +00:00
basic_relationship_joining_singleton_with_array.yaml Fix remote relationship invalid type name issue (fix hasura/graphql-engine#8002) 2022-01-27 14:34:01 +00:00
basic_relationship_with_permissions1.yaml Fix remote relationship invalid type name issue (fix hasura/graphql-engine#8002) 2022-01-27 14:34:01 +00:00
basic_relationship_with_permissions2.yaml Fix remote relationship invalid type name issue (fix hasura/graphql-engine#8002) 2022-01-27 14:34:01 +00:00
basic_relationship.yaml Fix remote relationship invalid type name issue (fix hasura/graphql-engine#8002) 2022-01-27 14:34:01 +00:00
complex_multiple_joins.yaml Fix remote relationship invalid type name issue (fix hasura/graphql-engine#8002) 2022-01-27 14:34:01 +00:00
delete_remote_rel.yaml Fix remote relationship invalid type name issue (fix hasura/graphql-engine#8002) 2022-01-27 14:34:01 +00:00
drop_col_with_remote_rel_dependency.yaml Fix remote relationship invalid type name issue (fix hasura/graphql-engine#8002) 2022-01-27 14:34:01 +00:00
drop_table_with_remote_rel_dependency.yaml Fix remote relationship invalid type name issue (fix hasura/graphql-engine#8002) 2022-01-27 14:34:01 +00:00
mixed_fragments.yaml Fix remote relationship invalid type name issue (fix hasura/graphql-engine#8002) 2022-01-27 14:34:01 +00:00
mixed_interface.yaml Fix remote relationship invalid type name issue (fix hasura/graphql-engine#8002) 2022-01-27 14:34:01 +00:00
mixed_variables.yaml Fix remote relationship invalid type name issue (fix hasura/graphql-engine#8002) 2022-01-27 14:34:01 +00:00
mutation_output_with_remote_join_fields.yaml Rewrite GraphQL schema generation and query parsing (close #2801) (#4111) 2020-08-21 12:27:01 -05:00
query_with_arguments.yaml Fix remote relationship invalid type name issue (fix hasura/graphql-engine#8002) 2022-01-27 14:34:01 +00:00
query_with_arr_rel.yaml Fix remote relationship invalid type name issue (fix hasura/graphql-engine#8002) 2022-01-27 14:34:01 +00:00
query_with_deep_nesting_arr.yaml Remote Joins: Create relationships across database and remote schemas (#2392) 2020-05-27 20:32:58 +05:30
query_with_deep_nesting_complex_path_arr2.yaml Fix remote relationship invalid type name issue (fix hasura/graphql-engine#8002) 2022-01-27 14:34:01 +00:00
query_with_deep_nesting_complex_path_arr.yaml Fix remote relationship invalid type name issue (fix hasura/graphql-engine#8002) 2022-01-27 14:34:01 +00:00
query_with_deep_nesting_complex_path_obj2.yaml Fix remote relationship invalid type name issue (fix hasura/graphql-engine#8002) 2022-01-27 14:34:01 +00:00
query_with_deep_nesting_complex_path_obj.yaml Fix remote relationship invalid type name issue (fix hasura/graphql-engine#8002) 2022-01-27 14:34:01 +00:00
query_with_deep_nesting_obj.yaml Remote Joins: Create relationships across database and remote schemas (#2392) 2020-05-27 20:32:58 +05:30
query_with_errors_arr.yaml Fix remote relationship invalid type name issue (fix hasura/graphql-engine#8002) 2022-01-27 14:34:01 +00:00
query_with_errors_obj.yaml Fix remote relationship invalid type name issue (fix hasura/graphql-engine#8002) 2022-01-27 14:34:01 +00:00
query_with_object_rel.yaml Fix remote relationship invalid type name issue (fix hasura/graphql-engine#8002) 2022-01-27 14:34:01 +00:00
query_with_scalar_rel.yaml Fix remote relationship invalid type name issue (fix hasura/graphql-engine#8002) 2022-01-27 14:34:01 +00:00
regression_7172.yaml server: Add regression tests for hasura/graphql-engine#7172 2021-08-25 21:06:09 +00:00
remote_join_with_computed_field_session.yaml server/postgres: Support scalar computed fields in remote joins 2021-07-12 16:04:37 +00:00
remote_join_with_computed_field.yaml server/postgres: Support scalar computed fields in remote joins 2021-07-12 16:04:37 +00:00
remote_rel_enum.yaml Fix remote relationship invalid type name issue (fix hasura/graphql-engine#8002) 2022-01-27 14:34:01 +00:00
remote_rel_fragments.yaml Fix remote relationship invalid type name issue (fix hasura/graphql-engine#8002) 2022-01-27 14:34:01 +00:00
remote_rel_interface.yaml Fix remote relationship invalid type name issue (fix hasura/graphql-engine#8002) 2022-01-27 14:34:01 +00:00
remote_rel_union.yaml Fix remote relationship invalid type name issue (fix hasura/graphql-engine#8002) 2022-01-27 14:34:01 +00:00
remote_rel_variables.yaml Fix remote relationship invalid type name issue (fix hasura/graphql-engine#8002) 2022-01-27 14:34:01 +00:00
remote_rel_with_null_joining_fields.yaml server: query remote server in a remote join query iff all arguments are not null (#31) 2020-11-18 09:00:12 +00:00
remote_relationship_field_type.yaml Fix remote relationship invalid type name issue (fix hasura/graphql-engine#8002) 2022-01-27 14:34:01 +00:00
remove_remote_schema.yaml Remote Joins: Create relationships across database and remote schemas (#2392) 2020-05-27 20:32:58 +05:30
rename_col_with_remote_rel_dependency.yaml Fix remote relationship invalid type name issue (fix hasura/graphql-engine#8002) 2022-01-27 14:34:01 +00:00
rename_table_with_remote_rel_dependency.yaml Fix remote relationship invalid type name issue (fix hasura/graphql-engine#8002) 2022-01-27 14:34:01 +00:00
select_remote_fields.yaml Fix remote relationship invalid type name issue (fix hasura/graphql-engine#8002) 2022-01-27 14:34:01 +00:00
setup_address.yaml Fix remote relationship invalid type name issue (fix hasura/graphql-engine#8002) 2022-01-27 14:34:01 +00:00
setup_all_relationships.yaml Fix remote relationship invalid type name issue (fix hasura/graphql-engine#8002) 2022-01-27 14:34:01 +00:00
setup_invalid_remote_rel_array.yaml Fix remote relationship invalid type name issue (fix hasura/graphql-engine#8002) 2022-01-27 14:34:01 +00:00
setup_invalid_remote_rel_computed_field.yaml server/postgres: Support scalar computed fields in remote joins 2021-07-12 16:04:37 +00:00
setup_invalid_remote_rel_hasura_field.yaml Fix remote relationship invalid type name issue (fix hasura/graphql-engine#8002) 2022-01-27 14:34:01 +00:00
setup_invalid_remote_rel_literal.yaml Fix remote relationship invalid type name issue (fix hasura/graphql-engine#8002) 2022-01-27 14:34:01 +00:00
setup_invalid_remote_rel_nested_args.yaml Fix remote relationship invalid type name issue (fix hasura/graphql-engine#8002) 2022-01-27 14:34:01 +00:00
setup_invalid_remote_rel_remote_args.yaml Fix remote relationship invalid type name issue (fix hasura/graphql-engine#8002) 2022-01-27 14:34:01 +00:00
setup_invalid_remote_rel_remote_field.yaml Fix remote relationship invalid type name issue (fix hasura/graphql-engine#8002) 2022-01-27 14:34:01 +00:00
setup_invalid_remote_rel_remote_schema.yaml Fix remote relationship invalid type name issue (fix hasura/graphql-engine#8002) 2022-01-27 14:34:01 +00:00
setup_invalid_remote_rel_variable.yaml Fix remote relationship invalid type name issue (fix hasura/graphql-engine#8002) 2022-01-27 14:34:01 +00:00
setup_multiple_remote_rel.yaml Fix remote relationship invalid type name issue (fix hasura/graphql-engine#8002) 2022-01-27 14:34:01 +00:00
setup_regression_7172.yaml server: Add regression tests for hasura/graphql-engine#7172 2021-08-25 21:06:09 +00:00
setup_remote_rel_array.yaml Fix remote relationship invalid type name issue (fix hasura/graphql-engine#8002) 2022-01-27 14:34:01 +00:00
setup_remote_rel_basic_with_authors.yaml Rewrite GraphQL schema generation and query parsing (close #2801) (#4111) 2020-08-21 12:27:01 -05:00
setup_remote_rel_basic.yaml Fix remote relationship invalid type name issue (fix hasura/graphql-engine#8002) 2022-01-27 14:34:01 +00:00
setup_remote_rel_computed_fields.yaml server/postgres: Support scalar computed fields in remote joins 2021-07-12 16:04:37 +00:00
setup_remote_rel_joining_singleton_with_array.yaml Fix remote relationship invalid type name issue (fix hasura/graphql-engine#8002) 2022-01-27 14:34:01 +00:00
setup_remote_rel_multiple_fields.yaml Fix remote relationship invalid type name issue (fix hasura/graphql-engine#8002) 2022-01-27 14:34:01 +00:00
setup_remote_rel_nested_args_multiple_results.yaml Fix remote relationship invalid type name issue (fix hasura/graphql-engine#8002) 2022-01-27 14:34:01 +00:00
setup_remote_rel_nested_args.yaml Fix remote relationship invalid type name issue (fix hasura/graphql-engine#8002) 2022-01-27 14:34:01 +00:00
setup_remote_rel_nested_fields.yaml Fix remote relationship invalid type name issue (fix hasura/graphql-engine#8002) 2022-01-27 14:34:01 +00:00
setup_remote_rel_null_joining_fields.yaml server: query remote server in a remote join query iff all arguments are not null (#31) 2020-11-18 09:00:12 +00:00
setup_remote_rel_scalar.yaml Fix remote relationship invalid type name issue (fix hasura/graphql-engine#8002) 2022-01-27 14:34:01 +00:00
setup_remote_rel_with_enum.yaml Fix remote relationship invalid type name issue (fix hasura/graphql-engine#8002) 2022-01-27 14:34:01 +00:00
setup_remote_rel_with_errors.yaml Fix remote relationship invalid type name issue (fix hasura/graphql-engine#8002) 2022-01-27 14:34:01 +00:00
setup_remote_rel_with_interface.yaml Fix remote relationship invalid type name issue (fix hasura/graphql-engine#8002) 2022-01-27 14:34:01 +00:00
setup_remote_rel_with_union.yaml Fix remote relationship invalid type name issue (fix hasura/graphql-engine#8002) 2022-01-27 14:34:01 +00:00
setup_with_permissions.yaml Fix remote relationship invalid type name issue (fix hasura/graphql-engine#8002) 2022-01-27 14:34:01 +00:00
setup.yaml Fix remote relationship invalid type name issue (fix hasura/graphql-engine#8002) 2022-01-27 14:34:01 +00:00
subscription_with_remote_join_fields.yaml Fix remote relationship invalid type name issue (fix hasura/graphql-engine#8002) 2022-01-27 14:34:01 +00:00
teardown_address.yaml Remote Joins: Create relationships across database and remote schemas (#2392) 2020-05-27 20:32:58 +05:30
teardown.yaml Fix remote relationship invalid type name issue (fix hasura/graphql-engine#8002) 2022-01-27 14:34:01 +00:00
update_basic_query.yaml Fix remote relationship invalid type name issue (fix hasura/graphql-engine#8002) 2022-01-27 14:34:01 +00:00
update_remote_rel_basic.yaml Fix remote relationship invalid type name issue (fix hasura/graphql-engine#8002) 2022-01-27 14:34:01 +00:00
with_relay.yaml Fix remote relationship invalid type name issue (fix hasura/graphql-engine#8002) 2022-01-27 14:34:01 +00:00