Skip to content
This repository was archived by the owner on Dec 18, 2024. It is now read-only.

Inconsistency in data type of returned JSON objects #261

Closed
nayakned opened this issue Apr 8, 2022 · 2 comments
Closed

Inconsistency in data type of returned JSON objects #261

nayakned opened this issue Apr 8, 2022 · 2 comments

Comments

@nayakned
Copy link
Contributor

nayakned commented Apr 8, 2022

Currently all fields of the request/response JSON object is string.
The only exception is error.number in an event of an error.

Either we need to correct this inconsistency or document the exceptions.

{
    "action": "get", 
    "data": {
        "dp": {
            "ts": "2022-04-08T11:26:23.1649413583Z", 
            "value": "68"
        }, 
        "path": "Vehicle.Speed"
    }, 
    "requestId": "05b9eb16-5216-4371-9c47-bff2c8aa0421", 
    "ts": "2022-04-08T11:26:23.1649413583Z"
}

{
    "action": "get", 
    "error": {
        "message": "I can not find Vehicle.Speed1 in my db", 
        "number": 404, 
        "reason": "Path not found"
    }, 
    "requestId": "51a2b9fa-f576-45b3-8767-6c5504b6518b", 
    "ts": "2022-04-08T11:27:19.1649413639Z"
}

@nayakned nayakned changed the title Inconsistency in data type of error.number Inconsistency in data type of returned JSON objects Apr 10, 2022
@nayakned
Copy link
Contributor Author

Also found in the subscriptionId which is returned as an int instead of a string.

{
    "action": "subscribe", 
    "requestId": "6bbccf7c-e8ca-4cbe-b869-6e8535491ea3", 
    "subscriptionId": 1350997395, 
    "ts": "2022-04-10T12:07:01.1649588821Z"
}

This has the consequence that if the subscriptionId is used for unsubscribing as a string, then there may be an unintended side effects in kuksa.val server.

VERBOSE: Receive action: unsubscribe
terminate called after throwing an instance of 'jsoncons::json_runtime_error<std::runtime_error, void>'
  what():  Integer overflow

@SebastianSchildt
Copy link
Contributor

Fixed

# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants