Skip to content

Possible bug in exposing WoT formats attribute #364

@SteinerPascal

Description

@SteinerPascal

I was following the starter template. I created my own thing and serving it worked well. You can find it on gist. Except, that the forms attribute of my action has changed. It got changed to some apparently standard forms attribute. The console output was the following:

"actions":{"takePhoto":{"title":"takePhoto","description":"description","input":{"unit":"","type":"string"},"forms":[{"href":"http://192.168.8.128:8080/KWH2/actions/takePhoto","contentType":"application/json","op":["invokeaction"],"htv:methodName":"POST"}],"idempotent":false,"safe":false}},


the contentType of my action got changed from image/jpeg to application/json. I tracked the issue down a bit and figured out it happens when i call exposedthing.expose() . More detailed in getServient().expose(_this)
https://github.com/eclipse/thingweb.node-wot/blob/6854ab79022a7c71ee627a6f77a23e0eaaa9d702/packages/core/src/exposed-thing.ts#L99
At this point the _thing still contains the proper form attribute with the image/jpeg.
But then in Servient.expose() Line 133 you are going to overwrite it.
https://github.com/eclipse/thingweb.node-wot/blob/6854ab79022a7c71ee627a6f77a23e0eaaa9d702/packages/core/src/servient.ts#L115-L137
Is this behavior wanted or is this a bug?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions