Skip to content

Use enum for labels of enum field

Some fields are labels of other fields which are of an enum type, but are not themselves of an enum type. This can lead to inconsistencies when the main field is the same but the label one differ. For example, running the following query:

Click to reveal the query

query Query {
  modifications(where: { id_IN: ["MOD_00000", "MOD_00424"] }) {
    id
    type
    type_label
  }
}

, we can notice that the type are the same for the two modifications but the type_label differ. As type is of an enum type, type_label options should be limited by type options (this would also help for Typescript types generation on client side development)

The concerned fields are:

  • Guide.subclass_label (linked to Guide.subclass of GuideClass enum type)
  • Modification.type_label & Modification.short_type_label ( both linked to Modification.type of ModifType enum type)
Edited by Julien Touchais