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

Invalid notification on PATCH Entity, updating attributes #559

Closed
kzangeli opened this issue Oct 23, 2020 · 1 comment
Closed

Invalid notification on PATCH Entity, updating attributes #559

kzangeli opened this issue Oct 23, 2020 · 1 comment

Comments

@kzangeli
Copy link
Collaborator

When updating an attribute A1, using PATCH /entities/*/attrs, the notification sent contains the old attribute A1.
But not only that, the notification also contains an extra, expanded copy of other attributes of the entity ...
Tests done using the functest ngsild_patch_entity_attr_with_subscription.test:

Entity Creation:

payload='{
  "id": "urn:ngsi-ld:entity:E1",
  "type": "T",
  "A1": {
    "type": "Property",
    "value": "A1 Step 1",
    "PP1": {
      "type": "Property",
      "value": "A1::PP1 Step 1"
    }
  },
  "A2": {
    "type": "Property",
    "value": "A2 Step 1"
  }
}'
orionCurl --url /ngsi-ld/v1/entities -X POST --payload "$payload"

Update of A1:

payload='{
  "A1": {
    "value": "A1 Step 3",
    "type": "Property"
  }
}'
orionCurl --url /ngsi-ld/v1/entities/urn:ngsi-ld:entity:E1/attrs -X PATCH --payload "$payload"

Notification:

{
    "data": [
        {
            "A1": {
                "PP1": {
                    "type": "Property",
                    "value": "A1::PP1 Step 1"
                },
                "type": "Property",
                "value": "A1 Step 3"
            },
            "A2": {
                "type": "Property",
		"value": "A2 Step 1"
            },
            "https://uri=etsi=org/ngsi-ld/default-context/A2": {
                "type": "Property",
                "value": "A2 Step 1"
            },
            "id": "urn:ngsi-ld:entity:E1",
            "type": "T"
        }
    ],
    "id": "urn:ngsi-ld:Notification:5f92cb702bf1bfd737aefcfb",
    "notifiedAt": "2020-10-23T12:24:16.535Z",
    "subscriptionId": "urn:ngsi-ld:subscriptions:S1",
    "type": "Notification"
}

Expected Notification:

{
    "data": [
        {
            "A1": {
                "type": "Property",
                "value": "A1 Step 3"
            },
            "A2": {
                "type": "Property",
                "value": "A2 Step 1"
            },
            "id": "urn:ngsi-ld:entity:E1",
            "type": "T"
        }
    ],
    "id": "urn:ngsi-ld:Notification:REGEX(.*)",
    "notifiedAt": "REGEX(.*)",
    "subscriptionId": "urn:ngsi-ld:subscriptions:S1",
    "type": "Notification"
}
@kzangeli kzangeli mentioned this issue Oct 23, 2020
@kzangeli
Copy link
Collaborator Author

kzangeli commented Dec 5, 2020

Fixed by @manaty226 in PR #604
Many thanks!

@kzangeli kzangeli closed this as completed Dec 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant