这是indexloc提供的服务,不要输入任何密码
Skip to content

Remote schema type prefix/suffix should be removed when the request is forwarded to the remote schema #9219

@BenoitRanque

Description

@BenoitRanque

Version Information

Server Version: 2.14.0

Environment

What is the current behaviour?

To avoid type conflicts with remote schema, hasura allows the user to set type prefixes and suffixes.
This effectively namespaces the types and prevents conflicts.

Hasura maps variables to scalar or JSON values when proxied to remote schemas.
However, this mapping does not happen if the request includes enums.

This is an issue as the remote schema will not be able to process the query.

Given this schema:

enum TodoTypeEnum {
  work,
  rest
}

type Todo {
  description: String
  type: TodoTypeEnum
}

query {
  todo_by_type(type: TodoTypeEnum): Todo
}

And the following query:

query GetTodoByType ($todoType: TodoTypeEnum) {
  todo_by_type(type: $todoType) {
    type
    description
  }
}

Adding the type prefix remote_ will result in the following query being sent to the remote schema:

query GetTodoByType ($todoType: remote_TodoTypeEnum) {
  todo_by_type(type: $todoType) {
    type
    description
  }
}

The remote schema does not have a type remote_TodoTypeEnum, so the request is rejected.

What is the expected behaviour?

Hasura should remove prefixes as it forwards the request to the remote schema.

How to reproduce the issue?

  1. Add a type prefix to a remote schema
  2. Execute a request using either an enum input variable, either directly or as part of another input type
  3. The remote schema rejects the request

Metadata

Metadata

Assignees

No one assigned

    Labels

    k/bugSomething isn't workingp/highcandidate for being included in the upcoming sprintt/gql-services

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions