tot-ra / graphql-schema-registry

GraphQL schema registry
MIT License
372 stars 68 forks source link

Improve schema formatting & uniqueness check #168

Closed tot-ra closed 2 years ago

tot-ra commented 2 years ago

Problem definition

Currently, whatever service tries to register as its schema, is directly stored in DB https://github.com/pipedrive/graphql-schema-registry/blob/master/src/database/schema.ts#L259

The problem is that

  1. performance. Doing comparison of medium text (schema as input) against medium text (stored schema) seems like a costly operation in mysql.. especially if you have a lot of schemas registered over time.
  2. sometimes there are extra whitespaces & tabs that make schema not well formatted
  3. if service changes even a whitespace character, then it is considered as new schema 3.1 if we would add another variable column (lets name it meta with type JSON to the schema) that could contain extra data, like query cost or access controls, then uniqueness check would become even more complex

Suggested solution

Related Issues

tot-ra commented 2 years ago

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