apoc.graph.validateDocument

Details

Syntax

apoc.graph.validateDocument(json [, config ]) :: (row)

Description

Validates the JSON file and returns the result of the validation.

Input arguments

Name

Type

Description

json

ANY

The JSON object to validate.

config

MAP

{ write = false :: BOOLEAN, labelField = 'type' :: STRING. idField = 'id' :: STRING, generateID = true :: BOOLEAN, defaultLabel = '' :: STRING, skipValidation = false :: BOOLEAN, mappings = {} :: MAP }. The default is: {}.

Return arguments

Name

Type

Description

row

MAP

The result of the validation.

Usage Examples

CALL apoc.graph.validateDocument('[{"foo": "foo"}, {"bar": "bar", "id": 1, "type": "label"}, {"fooBar": "fooBar", "id": 1}]');
Results
row

{message: "The object {\"foo\":\"foo\",\"id\":\"9447525f-8a2b-4ab9-b440-b80396741683\"} must have type as label-field name", index: 0}

{message: "The object {\"fooBar\":\"fooBar\",\"id\":1} must have type as label-field name", index: 2}