Skip to content

why use can't directive @convertEmptyStringsToNullvalue with enums (empty string) ? #2625

Closed as not planned
@baonguyen212002

Description

@baonguyen212002

Describe the bug

Expected behavior/Solution

Steps to reproduce

 type Query {
    userAttendanceStatistics(
        dateRange: DateRange @whereBetween
        userId: ID @where
        blockType: AttendanceBlockType @convertEmptyStringsToNull
    ): [UserAttendanceStatistics]
}
query userAttendanceStatistics($dateRange: DateRange, $userId: ID, $blockType: AttendanceBlockType) {
  userAttendanceStatistics(
    dateRange: $dateRange
    userId: $userId
    blockType: $blockType
  ) {
    user {
      id
      name
      avatar
      position
      name
      nickname
      email
      phone
      __typename
    }
    checkin
    checkout
    totalWorkingHours
    status
    __typename
  }
}
{
  "dateRange": {
    "from": "2024-10-25",
    "to": "2024-10-25"
  },
  "userId": "9",
  "blockType": ""
}

Output/Logs

{
  "errors": [
    {
      "message": "Variable \"$blockType\" got invalid value (empty string); Expected type AttendanceBlockType.",
      "extensions": {
        "category": "graphql"
      },
      "locations": [
        {
          "line": 1,
          "column": 68
        }
      ]
    }
  ]
}
Click to expand
# Add in log output/error messages here

Lighthouse Version

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions