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

graphql-default naming convention introduces underscores somewhere between v2.10.2 and v2.18.0 #9430

@AxelUlmestig

Description

@AxelUlmestig

Version Information

MacOS:

$ echo $OSTYPE
darwin21.0

Server Version:
hasura/graphql-engine:v2.18.0.cli-migrations-v3 Docker image

CLI Version (for CLI related issue):
hasura/graphql-engine:v2.18.0.cli-migrations-v3 Docker image

Environment

run on local machine in Docker

What is the current behaviour?

Settings the environment variables

HASURA_GRAPHQL_EXPERIMENTAL_FEATURES: naming_convention
HASURA_GRAPHQL_DEFAULT_NAMING_CONVENTION: graphql-default

with the v2.18.0.cli-migrations-v3 image and then exporting the schema to a file using gq

gq http://127.0.0.1:8080/v1/graphql -H 'x-hasura-admin-secret: admin' --introspect > schema.graphql

Then the order by aggregate types are written in snake_case:

input FriendsAggregateOrderBy {
  ...
  max: friends_max_order_by
}

What is the expected behaviour?

When the same is done with the v2.10.2.cli-migrations-v2 image, then the result is in PascalCase:

input FriendsAggregateOrderBy {
   ...
   max: FriendsMaxOrderBy
}

I expected it to stay as PascalCase when I upgraded the image.

How to reproduce the issue?

I have created a repo with a script that reproduces the error

I recommend using the script in the repo, but you can run it manually too:

  • Make sure that gq is installed (npm install -g graphqurl).
  • Set up a Hasura environment where there's an array relationship present
  • Start the containers: docker-compose up -d
  • Apply database migrations: docker compose exec db sqitch --chdir db deploy
  • Apply Hasura metadata: docker compose exec graphql-engine hasura-cli --project /hasura-config metadata apply
  • Export the graphql schema: gq http://127.0.0.1:8080/v1/graphql -H 'x-hasura-admin-secret: admin' --introspect > schema.graphql
  • Verify that nothing has changed: git diff schema.graphql
  • Update the hasura version:
    hasura_v210='hasura/graphql-engine:v2.10.2.cli-migrations-v2'
    hasura_v218='hasura/graphql-engine:v2.18.0.cli-migrations-v3'
    
    sed -i '' "s#$hasura_v210#$hasura_v218#g" docker-compose.yaml
    
  • Restart the containers with to get the new version: docker compose down; docker compose up -d
  • Export the schema again: gq http://127.0.0.1:8080/v1/graphql -H 'x-hasura-admin-secret: admin' --introspect > schema.graphql
  • Check the diff: git diff schema.graphql

Screenshots or Screencast

Please provide any traces or logs that could help here.

Any possible solutions/workarounds you're aware of?

Keywords

  • casing
  • naming_convention
  • graphql-default

Metadata

Metadata

Assignees

No one assigned

    Labels

    k/bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions