Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unit breaks OpenAPI conversion #36

Open
egekorkan opened this issue Aug 30, 2023 · 3 comments
Open

Unit breaks OpenAPI conversion #36

egekorkan opened this issue Aug 30, 2023 · 3 comments
Labels

Comments

@egekorkan
Copy link
Member

egekorkan commented Aug 30, 2023

A TD like below results in an error when trying to convert to Open API due to presence of unit. Removing unit fixes the transformation.

{
    "@context": "https://www.w3.org/2022/wot/td/v1.1",
    "title": "Coffee Machine",
    "securityDefinitions": {
        "nosec_sc": {
            "scheme": "nosec"
        }
    },
    "security": [
        "nosec_sc"
    ],
    "properties": {
        "resources": {
            "readOnly": true,
            "observable": true,
            "type": "object",
            "properties": {
                "water": {
                    "type": "integer",
                    "minimum": 10,
                    "maximum": 100,
                    "unit": "%"
                }
            },
            "forms": [
                {
                    "href": "http://192.168.1.112:8081/coffee-machine/properties/resources",
                    "contentType": "application/json",
                    "op": [
                        "readproperty"
                    ],
                    "htv:methodName": "GET"
                }
            ],
            "writeOnly": false
        }
    },
    "id": "urn:uuid:e8319e4c-ee5c-4a8b-a8f5-b2f255789431",
    "description": "A simple coffee machine that can be interacted over the Internet",
    "support": "https://github.com/eclipse-thingweb/node-wot/"
}
@egekorkan egekorkan changed the title Unit of % breaks OpenAPI conversion Unit breaks OpenAPI conversion Aug 30, 2023
@egekorkan egekorkan transferred this issue from eclipse-thingweb/playground Jul 12, 2024
@bw-hro
Copy link

bw-hro commented Nov 4, 2024

Same is true for action input specification when input type is object. When input type is a primitive like integer unit property is working. Also cf. listing below:

"fade":{
    "input": {
        "type":"object",
        "properties":{
            "brightness":{
                "type": "integer",
                "minimum": 0,
                "maximum": 100,
                "unit": "percent"
            },
            "duration":{
                "type": "integer",
                "unit": "milliseconds"
            }
        }
    },
    "forms": [{
        "href": "http://lamp.example.com/fade",
        "op": "invokeaction",
        "contentType": "application/json"
    }],
    "safe": false,
    "idempotent": false
}

Does this issue already have a priority and is there a chance that it will be fixed in not so far future?

@danielpeintner
Copy link
Member

Minor (and just partly related to this issue): @egekorkan given that we have several tools in this repo it makes sense to create a dedicated label for each. Doing so we can more easily filter issues and PRs. Is this fine by you and others?

image

@egekorkan
Copy link
Member Author

given that we have several tools in this repo it makes sense to create a dedicated label for each

I agree! I am going to create it :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants