Starfish API Documentation

Validation Errors

When creating or modifying entities in the system using the API you may encounter validation errors. Each validation error will identify the field used in the mutation input, and the problem with it. Make sure to query for errors { path message } with each mutation.

Query

mutation($input: CreateContactLensPrescriptionMutationInput!) {
  createContactLensPrescription(input: $input) {
    prescription {
      id
    }
    errors {
      message
      path
    }
  }
}

Variables

{
  "input": {
    "userId": "AccountHolder-XL3FBMGL86",
    "validityPeriod": {
      "startDate": "2021-05-21",
      "expiryDate": "2021-05-19"
    },
    "patient": {
      "firstName": "",
      "lastName": "",
      "dateOfBirth": "2980-02-02"
    },
    "doctor": {
      "doctorsName": "",
      "phoneNumber": "",
      "locationName": "",
      "addressLine1": "",
      "city": "",
      "countryCode": "",
      "postalCode": "",
      "region": "ZZ"
    },
    "createdById": "StaffMember-WVNFD3KPVRD"
  }
}

Response

{
  "data": {
    "createContactLensPrescription": {
      "prescription": null,
      "errors": [
        {
          "message": "can't be blank",
          "path": [
            "input",
            "patient",
            "firstName"
          ]
        },
        {
          "message": "can't be blank",
          "path": [
            "input",
            "patient",
            "lastName"
          ]
        },
        {
          "message": "must be in the past",
          "path": [
            "input",
            "patient",
            "dateOfBirth"
          ]
        },
        {
          "message": "Must have at least one eye",
          "path": [
            "input"
          ]
        },
        {
          "message": "can't be in the future",
          "path": [
            "input",
            "validityPeriod",
            "startDate"
          ]
        },
        {
          "message": "can't be blank",
          "path": [
            "input",
            "doctor",
            "addressLine1"
          ]
        },
        {
          "message": "can't be blank",
          "path": [
            "input",
            "doctor",
            "city"
          ]
        },
        {
          "message": "can't be blank",
          "path": [
            "input",
            "doctor",
            "postalCode"
          ]
        },
        {
          "message": "can't be blank",
          "path": [
            "input",
            "doctor",
            "countryCode"
          ]
        },
        {
          "message": "is not included in the list",
          "path": [
            "input",
            "doctor",
            "countryCode"
          ]
        },
        {
          "message": "must be one of SV, US",
          "path": [
            "input",
            "doctor",
            "countryCode"
          ]
        },
        {
          "message": "must be after the start date",
          "path": [
            "input",
            "validityPeriod",
            "expiryDate"
          ]
        }
      ]
    }
  }
}