API Connect

 View Only

 API Request Schema Validation requirement (allow null value)

Srinivas Poram's profile image
Srinivas Poram posted Sat June 07, 2025 01:33 PM

I have a schema requirement where I have a specific field which holds string data type with some limit on maximum length. But it can also have a null value at times.

I have selected the nullable checkbox for that specific field while creating the schema. But when I try to publish I end up with an below validation error.

Request the experts to please guide me as to what can be done to address this issue.

Schemadef:  

MemberInfoRequestDef:
    title: TestAPIRequestMsg
    type: object
    additionalProperties: false
    properties:
      locationId:
        title: locationId
        type: string
        maxLength: 14
        nullable: true

Error Message: Additional properties not allowed: nullable at #/definitions/TestAPIRequestDef/properties/locationId

Steve Linn's profile image
Steve Linn

Hi Sirinivan,
I starting to get rusty after being on the shelf 5 months, but DataPower is using the jsv specification draft 4 and I believe nullable was added in a later specification.  The only thing I can think of is to specify both the string a null type, ie

type:
  - string
  - null

Best Regards,

Steve Linn