I've encountered a problem with Payload CMS where a GraphQL error related to enum value naming is causing issues. The problem arises with a collection named FormSubmission that includes a field called appointmentTime, which utilizes a select field type with predetermined options. Let's take a look at the relevant code snippet:
import { CollectionConfig } from "payload/types";
const FormSubmission: CollectionConfig = {
slug: "form-submissions",
fields: [
{
type: "select",
name: "appointmentTime",
label: "Appointment Time",
required: true,
options: [
{ label: "09:00 AM", value: "09:00" },
{ label: "10:00 AM", value: "10:00" },
{ label: "11:00 AM", value: "11:00" },
{ label: "12:00 PM", value: "12:00" },
{ label: "01:00 PM", value: "13:00" },
{ label: "02:00 PM", value: "14:00" },
{ label: "03:00 PM", value: "15:00" },
{ label: "04:00 PM", value: "16:00" },
{ label: "05:00 PM", value: "17:00" },
],
},
],
};
export default FormSubmission;
Upon running the application with yarn run dev, the following error is displayed:
unhandledRejection GraphQLError: Names must only contain [_a-zA-Z0-9] but "_9:00" does not.
The code was functioning correctly previously, and no changes have been made. The latest versions of both Payload CMS and its dependencies are being utilized. It's unclear what could be causing this issue, considering the enum values in the code seem valid. Any insights or suggestions on resolving this error would be greatly appreciated.
I have attempted to resolve the issue by deleting the file and starting over, restarting the dev server, and isolating the code with /*