openownership / lib-cove-bods

Check that your data complies with the Beneficial Ownership Data Standard (BODS) using our install our data review library to analyse files via your command line interface
https://datareview.openownership.org/
Other
1 stars 0 forks source link

Additional check: Annotiation.statementPointerTarget is valid #107

Closed kd-ods closed 1 month ago

kd-ods commented 3 months ago

Specification for Check(s):

Check 1

Check that annotations.[].statementPointerTarget is a valid RFC6901 JSON Pointer (https://tools.ietf.org/html/rfc6901)

On pass:

On fail:

Check 2

Check that annotations.[].statementPointerTarget points to an existing value in the parent statement

On fail:

kathryn-ods commented 3 months ago

Valid data 1

[
  {
    "statementId": "1dc0e987-5c57-4a1c-b3ad-61353b66a9b7",
    "declarationSubject": "c359f58d2977",
    "statementDate": "2020-03-04",
    "recordId": "c359f58d2977",
    "recordType": "entity",
    "annotations":[
      {
        "statementPointerTarget":"",
        "motivation": "commenting" 
      }
    ],
    "recordDetails": {
      "isComponent": false,
      "entityType": {
        "type": "registeredEntity"
      }
    }
  }
]

Valid data 2

[
  {
    "statementId": "019a93f1-e470-42e9-957b-03559861b2e2",
    "declarationSubject": "c359f58d2977",
    "statementDate": "2020-03-04",
    "recordId": "10478c6cf6de",
    "recordType": "person",
    "annotations":[
      {
        "statementPointerTarget": "/statementId",
        "motivation": "correcting"
      }
    ],
    "recordDetails": {
      "isComponent": false,
      "personType": "knownPerson"
    }
  }
]

Invalid 1 - not formatted correctly as a pointer

[
  {
    "statementId": "019a93f1-e470-42e9-957b-03559861b2e2",
    "declarationSubject": "c359f58d2977",
    "statementDate": "2020-03-04",
    "recordId": "10478c6cf6de",
    "recordType": "person",
    "annotations":[
      {
        "statementPointerTarget": "statementId",
        "motivation": "correcting"
      }
    ],
    "recordDetails": {
      "isComponent": false,
      "personType": "knownPerson"
    }
  }
]

Invalid 2 - field doesn't exist

[
  {
    "statementId": "1dc0e987-5c57-4a1c-b3ad-61353b66a9b7",
    "declarationSubject": "c359f58d2977",
    "statementDate": "2020-03-04",
    "recordId": "c359f58d2977",
    "recordType": "entity",
    "annotations":[
      {
        "statementPointerTarget":"/test",
        "motivation": "commenting"
      }
    ],
    "recordDetails": {
      "isComponent": false,
      "entityType": {
        "type": "registeredEntity"
      }
    }
  }
]

Invalid 3 - field doesn't exist but is a field defined in the schema

[
  {
    "statementId": "1dc0e987-5c57-4a1c-b3ad-61353b66a9b7",
    "declarationSubject": "c359f58d2977",
    "statementDate": "2020-03-04",
    "recordId": "c359f58d2977",
    "recordType": "entity",
    "annotations":[
      {
        "statementPointerTarget":"/recordDetails/entityType/subtype",
        "motivation": "identifying"
      }
    ],
    "recordDetails": {
      "isComponent": false,
      "entityType": {
        "type": "registeredEntity"
      }
    }
  }
]