IBM Support

Calling an API fails with response code 422 error when passing null value

Troubleshooting


Problem

In an API, the validate policy is set to employeeChangeRequest definition
            - operations:
                - change_employee
              execute:
                ...
                - validate:
                    version: 2.7.0
                    title: validate
                    graphql-error-policy: all
                    compile-settings: {}
                    validate-against: definition
                    definition: '#/components/schemas/employeeChangeRequest'
Where : 
    employeeChangeRequest:
      type: object
      description: Employee Data Change Request.
      properties:
        Property1:
          type: string
          minLength: 1
          maxLength: 50
          example: AB
        Property2:
          type: string
          example: example2
        description:
          type: string
          minLength: 1
          maxLength: 50
          example: employee for ABC
      additionalProperties: false

Symptom

When calling the API with description set to a value like ABC, the call succeeds.
When calling the API with description set to null, the call fails with Response Code: 422 Error

Document Location

Worldwide

[{"Type":"MASTER","Line of Business":{"code":"LOB77","label":"Automation Platform"},"Business Unit":{"code":"BU048","label":"IBM Software"},"Product":{"code":"SSMNED","label":"IBM API Connect"},"ARM Category":[{"code":"a8m50000000CeEfAAK","label":"API Connect-\u003EDeveloper (DV)-\u003EPolicy"}],"ARM Case Number":"TS016534724","Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"10.0.5;and future releases"}]

Log InLog in to view more of this document

This document has the abstract of a technical article that is available to authorized users once you have logged on. Please use Log in button above to access the full document. After log in, if you do not have the right authorization for this document, there will be instructions on what to do next.

Document Information

Modified date:
11 July 2024

UID

ibm17160027