I have copied DoorResURI.swagger.json to door.json on the local pc.
and run below command,
hyuki@hyuki:~/git/C2C/mytest$ node ./tools/schema_validation.js -i ./door.json
input: ./door.json
/DoorResURI
get
200
schema_id : Door
example : { rt: [ 'oic.r.door' ],
if: [ 'oic.if.a', 'oic.if.baseline' ],
openState: 'Open',
openDuration: 'P0Y0M0DT2H25M5S',
openAlarm: true }
schema or x-example does not exist
To trace the error, I have added throw(error) below the log related with "schema or x-example does not exist".
And it provides me the callstack below.
/home/hyuki/git/C2C/mytest/tools/schema_validation.js:128
throw(err);
^
Error: can't resolve reference https://openconnectivityfoundation.github.io/core/schemas/oic.types-schema.json#/definitions/duration from id #
at Object.generate_ref [as code] (/home/hyuki/git/C2C/mytest/tools/node_modules/ajv/lib/dotjs/ref.js:61:22)
at Object.generate_validate [as validate] (/home/hyuki/git/C2C/mytest/tools/node_modules/ajv/lib/dotjs/validate.js:155:37)
at Object.generate_properties [as code] (/home/hyuki/git/C2C/mytest/tools/node_modules/ajv/lib/dotjs/properties.js:198:26)
at generate_validate (/home/hyuki/git/C2C/mytest/tools/node_modules/ajv/lib/dotjs/validate.js:228:37)
at localCompile (/home/hyuki/git/C2C/mytest/tools/node_modules/ajv/lib/compile/index.js:99:22)
at Ajv.compile (/home/hyuki/git/C2C/mytest/tools/node_modules/ajv/lib/compile/index.js:67:13)
at _compile (/home/hyuki/git/C2C/mytest/tools/node_modules/ajv/lib/ajv.js:328:29)
at Ajv.compile (/home/hyuki/git/C2C/mytest/tools/node_modules/ajv/lib/ajv.js:114:34)
at Object. (/home/hyuki/git/C2C/mytest/tools/schema_validation.js:113:36)
at Module._compile (module.js:652:30)
When I run schema_validation.js with below resource model, it seems to report error. https://github.com/openconnectivityfoundation/IoTDataModels/blob/master/DoorResURI.swagger.json
Can I know the reason of it ?
I have copied DoorResURI.swagger.json to door.json on the local pc. and run below command,
hyuki@hyuki:~/git/C2C/mytest$ node ./tools/schema_validation.js -i ./door.json input: ./door.json /DoorResURI get 200 schema_id : Door example : { rt: [ 'oic.r.door' ], if: [ 'oic.if.a', 'oic.if.baseline' ], openState: 'Open', openDuration: 'P0Y0M0DT2H25M5S', openAlarm: true } schema or x-example does not exist
To trace the error, I have added throw(error) below the log related with "schema or x-example does not exist".
And it provides me the callstack below.
/home/hyuki/git/C2C/mytest/tools/schema_validation.js:128 throw(err); ^ Error: can't resolve reference https://openconnectivityfoundation.github.io/core/schemas/oic.types-schema.json#/definitions/duration from id # at Object.generate_ref [as code] (/home/hyuki/git/C2C/mytest/tools/node_modules/ajv/lib/dotjs/ref.js:61:22) at Object.generate_validate [as validate] (/home/hyuki/git/C2C/mytest/tools/node_modules/ajv/lib/dotjs/validate.js:155:37) at Object.generate_properties [as code] (/home/hyuki/git/C2C/mytest/tools/node_modules/ajv/lib/dotjs/properties.js:198:26) at generate_validate (/home/hyuki/git/C2C/mytest/tools/node_modules/ajv/lib/dotjs/validate.js:228:37) at localCompile (/home/hyuki/git/C2C/mytest/tools/node_modules/ajv/lib/compile/index.js:99:22) at Ajv.compile (/home/hyuki/git/C2C/mytest/tools/node_modules/ajv/lib/compile/index.js:67:13) at _compile (/home/hyuki/git/C2C/mytest/tools/node_modules/ajv/lib/ajv.js:328:29) at Ajv.compile (/home/hyuki/git/C2C/mytest/tools/node_modules/ajv/lib/ajv.js:114:34) at Object. (/home/hyuki/git/C2C/mytest/tools/schema_validation.js:113:36)
at Module._compile (module.js:652:30)