graphql-schema-registry icon indicating copy to clipboard operation
graphql-schema-registry copied to clipboard

schema comparisons are not case sensitive by default

Open lefoulkrod opened this issue 2 years ago • 1 comments

When pushing a schema update where the only change is the case of a field, the update is ignored. This is likely because of the way the registry uses SQL to compare the incoming schema to the existing schema. Since MySQL is case-insensitive by default this causes the service to believe the schema already exists.

Steps to reproduce.

  1. Submit the initial schema to the registry
curl -X POST http://localhost:6001/schema/push \
-H 'Content-Type: application/json' \
--data-binary @- << 'EOF'
{
"name": "schema1",
"version": "1",
"type_defs": "type MyType { id: String} type Query { my: MyType }"
}
EOF
  1. Now submit an update to the schema. Notice the change to the id field of MyType from id to Id.
curl -X POST http://localhost:6001/schema/push \
-H 'Content-Type: application/json' \
--data-binary @- << 'EOF'
{
"name": "schema1",
"version": "1",
"type_defs": "type MyType { Id: String another: String } type Query { my: MyType }"
}
EOF
  1. View the schema in the registry UI. Notice there is only a single version of the schema and and the definition was not changed. image

lefoulkrod avatar Mar 04 '22 16:03 lefoulkrod

I put the wrong example curl command as command 2. It should be

curl -X POST http://localhost:6001/schema/push \
-H 'Content-Type: application/json' \
--data-binary @- << 'EOF'
{
"name": "schema1",
"version": "1",
"type_defs": "type MyType { Id: String} type Query { my: MyType }"
}
EOF

lefoulkrod avatar Mar 07 '22 15:03 lefoulkrod

solved in https://github.com/pipedrive/graphql-schema-registry/releases/tag/5.4.0

tot-ra avatar Oct 27 '22 13:10 tot-ra