hey everyone I have a random graphql question If I...
# orm-help
r
hey everyone I have a random graphql question If I have the following enum
Copy code
enum ProjectType {
    ML
    BLOCKCHAIN
    IOS
    ANDROID
    WEB
}
and I want to pull it on the front end. I can do this via introspection, but if I want custom casing like
ML, Blockchain, IOs, Android, Web
it would be difficult for the consumer to do this in a generic/dynamic way. Is there a way to add meta data to enum values so that it comes through on introspection? Any help would be appreciated!
f
I think you might be mixing concerns with data types and UI. Rather than have metadata for your UI language strings, you can treat the enum values as language keys
Copy code
const labels = {
    ML: 'ML',
    BLOCKCHAIN: 'Blockchain',
    IOS: 'IOs',
    ANDROID: 'Android',
    WEB: 'Web',
}
r
Thanks, I get the idea of separating the 2, but if you think of enums as master data, it kind of makes sense to create an access point to the data in a consistent format. If these enums are leveraged in multiple applications it becomes difficult to create consistency between those applications as they could all have different formatting. In the end I opted for using the description to provide the formatting. It works quite well. In future projects I probably won't use enums and rather just have an actual type so I have more control. Thanks for the suggestion though