twenty icon indicating copy to clipboard operation
twenty copied to clipboard

Creating an object/field with a name not compliant with GraphQL type names breaks the schema

Open Weiko opened this issue 10 months ago • 0 comments

Scope & Context

Each workspace has its own objects and graphql schema, defined through some metadata (objects, fields, relations, ...). If I create an object named "person", I should be able to query the API to retrieve my records of the Person object. The schema will have a Person type and its associated resolvers. Twenty will dynamically generate something like this:

query Person {
  person(filter: {id: { eq: "something"}}) {
    id
  }
}

This works well in most of the cases however Graphql does not accept type names such as "1Event" or "한국어", which means we need to also have the same kind of validation on our metadata names definition.

Technical inputs

Transliteration libraries could help with languages that use characters not accepted by Graphql regex, we will also need to escape special characters and numbers (or at least the ones that start with a number)

Weiko avatar Apr 12 '24 11:04 Weiko