I have a query that expects an enum of FileType to be passed on.
{
item(itemId: 123){
page(limit: 5, filters: {fileType: PDF}) {
row{
id
fileName
}
}
}
}
The fileType filter PDF is expected to be a FileType enum. Below are the enum values.
CSV
PDF
EXCEL
DOC
DOCX
PPT
PPTX
PNG
JPG
TIFF
UNKNOWN
I have created an enum and am passing the value into my query below (Python 3.8.5):
class FileType(str, Enum):
CSV = 'CSV'
PDF = 'PDF'
EXCEL = 'EXCEL'
DOC = 'DOC'
DOCX = 'DOCX'
PPT = 'PPT'
PPTX = 'PPTX'
PNG = 'PNG'
JPG = 'JPG'
TIFF = 'TIFF'
UNKNOWN = 'UNKNOWN'
vars = {
"itemId": itemId,
"limit": limit,
"filters": {
"fileType": json.dump(FileType.DOC)
}
}
When my code is run FileType.DOC is converted to "DOC" when I expect it to be DOC in the query like the example. How would I go about doing this?
I referenced the solutions in Serialising an Enum member to JSON but none of the would work for me.