Data Path Property Renamed
  • 19 Dec 2024
  • Dark
    Light
  • PDF

Data Path Property Renamed

  • Dark
    Light
  • PDF

Article summary

Breaking Change Notice (2023.2.0)

IAP 2023.2 introduces a breaking change that affects any custom logic that depends on the dataPath property in an API error object.

Input Validation Failures

Itential discovered that many APIs were reporting input validation failures as a list of validation report objects. These report objects would specify the individual property which caused the validation failure in a key called dataPath, as shown below (Example 1).

Example 1: Validation Report Objects (Before)

[
  {
    keyword: 'type',
    dataPath: '.failingProperty1',
    schemaPath: '#/properties/failingProperty1/type',
    params: { type: 'string' },
    message: 'should be string'
  },
  {
    keyword: 'type',
    dataPath: '.failingProperty2',
    schemaPath: '#/properties/failingProperty2/type',
    params: { type: 'string' },
    message: 'should be string'
  }
]

In previous releases, for any custom logic that depended on the dataPath property, the value was formatted as a dotted path (Example 2).

Example 2: Dotted Path (Before)

{
  keyword: 'type',
  dataPath: '.my.nested.property',
  schemaPath: '#/properties/my/properties/nested/properties/property/type',
  params: { type: 'string' },
  message: 'should be string'
}

With the 2023.2 IAP release, the dataPath property is now named instancePath, and its value is formatted as a JSON Pointer (Example 3).

Example 3: JSON Pointer (After)

{
  keyword: 'type',
  instancePath: '/my/nested/property',
  schemaPath: '#/properties/my/properties/nested/properties/property/type',
  params: { type: 'string' },
  message: 'should be string'
}

What should I do?

Update any code referring to dataPath to use instancePath instead. Additionally, if your logic uses the value of dataPath programmatically in some way, update that logic to use the new JSON Pointer format.


Was this article helpful?

Changing your password will log you out immediately. Use the new password to log back in.
First name must have atleast 2 characters. Numbers and special characters are not allowed.
Last name must have atleast 1 characters. Numbers and special characters are not allowed.
Enter a valid email
Enter a valid password
Your profile has been successfully updated.