"links" si no more allowed as PropertyMetadata
cescobaz opened this issue · 1 comments
Hello,
I created some Things for my Raspberry and every was working fine with version 0.13.0.
I just updated to 0.15.0 and I get the following:
/home/pi/webthing-home/node_modules/ajv/dist/compile/index.js:119
throw e;
^
Error: strict mode: unknown keyword: "links"
at Object.checkStrictMode (/home/pi/webthing-home/node_modules/ajv/dist/compile/validate/index.js:183:15)
at Object.checkUnknownRules (/home/pi/webthing-home/node_modules/ajv/dist/compile/util.js:32:24)
at checkKeywords (/home/pi/webthing-home/node_modules/ajv/dist/compile/validate/index.js:118:12)
at Object.validateFunctionCode (/home/pi/webthing-home/node_modules/ajv/dist/compile/validate/index.js:14:9)
at Ajv.compileSchema (/home/pi/webthing-home/node_modules/ajv/dist/compile/index.js:79:20)
at Ajv._compileSchemaEnv (/home/pi/webthing-home/node_modules/ajv/dist/core.js:446:37)
at Ajv.compile (/home/pi/webthing-home/node_modules/ajv/dist/core.js:141:38)
at new Property (/home/pi/webthing-home/node_modules/webthing/lib/property.js:30:29)
at makeVideoCameraHLS (/home/pi/webthing-home/src/lib/video-camera.js:78:5)
at createServer (/home/pi/webthing-home/src/raspi-1-server.js:19:39)
The code that raises the error is the following:
const imageValue = new Value(null)
thing.addProperty(
new Property(thing, 'image', imageValue, {
'@type': 'ImageProperty',
title: 'Snapshot',
links: [{ rel: 'alternate', mediaType: 'image/jpeg', href: `/media/${imageFilename}` }],
readOnly: true
}))
I read the lib code and I notice that there is a ajv
validation of metadata ( https://github.com/WebThingsIO/webthing-node/blob/master/lib/property.ts#L55 ) and some attributes are deleted and never read ( https://github.com/WebThingsIO/webthing-node/blob/master/lib/property.ts#L54 ), why?
I can't understand: PropertyMetadata interface let you write links
field ( https://github.com/WebThingsIO/webthing-node/blob/master/lib/property.ts#L172 ).
Metadata must be a JSONSchema or a PropertyMetadata object? How can I set links
property for my Raspberry camera?
( My complete code here https://github.com/cescobaz/webthing-home )
Many thanks
Action metadata seems to be incomplete too. At least unit
and properties
(for objects) are missing on ActionMetadata.input
. At least https://webthings.io/api/#example-action-object suggests, that those should exist.