Unfortunately, the answer is that you cannot. According to the GraphQL spec, an enum is defined as
Name but not true or false or null
"Name" here refers to this definition, which defines a "Name" with the regular expression
/[_A-Za-z][_0-9A-Za-z]*/
This means that enums (which are defined as "names values") can only have letters, numbers, or underscores, and the first character can't be a number. Additionally, the spec recommends that you use "all caps", which I read to mean "CONSTANT_CASE".
If an enum really is what you want, to follow the recommendation of the spec, you "should" use
enum ImageMimeTypes {
IMAGE_APNG
IMAGE_AVIF
IMAGE_GIF
IMAGE_JPEG
IMAGE_PNG
IMAGE_SVG_XML
IMAGE_WEBP
}
though I personally like to name my enums as singular constant case, as well -- just so it's less a surprise of what it represents -- so I'd probably call it IMAGE_MIME_TYPE
.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…