-
Notifications
You must be signed in to change notification settings - Fork 42
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
Bugs in /attrs PATCH endpoint #1385
Comments
ok, that sounds like a bug. Thanks for reporting! A word on Relationship attributes having the "object" as an array: This is something I implemented by mistake (I though it made a whole lot of sense), but, it's against the NGSi-LD API spec, I will not remove it though until I have implemented the new (in v1.8.1) attribute type "ListRelationship", that solves the "problem" about being able to have Relationships as arrays. |
Hi @kzangeli Thanks for the reply! |
Yes, a draft pre version of 1.8.1 has been published on the open area of ETSI isg cim. |
Only, bear in mind that this is not implemented in any NGSI-LD broker yet. It's fresh out of the oven, it's not even published yet, except in this "sneak-peek" of what's to come. |
Thanks @kzangeli! One last question. I might be wrong, but it seems that the |
Yes, you're right, I haven't implemented showChanges yet. But, it's not gonna be immediate, I have quite a lot to do, I'm afraid. I'll do my best to have "showChanges" done before summer vacations (August) |
No problem, thanks for the quick reply! Didn't think that you'd be so active. |
So, the bug has (hopefully) been fixed. |
Thanks for the quick fix, the main issue seems to be fixed! However, I do still have a small remark. Why is it, that updating a Property with a value that is a single-item array (e.g. ["test"]) makes the value of Property equal to the item inside the array (e.g. "test"). This is not the case with a Relationship. Here, updating the object value to a single-item array (e.g. ["urn:ngsi-ld:Test:001"]) makes the object value of the Relationship equal to the single-item array (["urn:ngsi-ld:Test:001"]). |
Yeah, I also don't like that "feature". Guess I never did that for relationships. BTW, I started with "show changes" this weekend. I'll let you know |
Ok, no problem! Thanks for helping!! |
Just wanted you to know I haven't forgotten about your issues. But, rest assured, I'm on the "showChanges" thing (found two bugs in the PATCH Entity operation while debugging "showChanges" and I need to fix those two in the same PR ,as functersts for showChanges fail). I kind of doubt it, but, hopefully I can fix all this before next Saturday cause next Sunday (July 2) I go to Athens for a European project meeting. Will be gone/busy all that week. Anyway, just wanted to update you on all this. |
No problem, thanks for being so active!! :) |
When updating a context broker attribute of type
Relationship
using the/attrs
endpoint where the new object value is an array of urns (e.g.["urn:ngsi-ld:Cargo:002"]
or["urn:ngsi-ld:Cargo:001", "urn:ngsi-ld:Cargo:002"]
), the relationshipobject
value within the context broker gets updated to""
(empty string) instead of the array of urns.Example: the entity of type
Transport
has an attribute cargo_ids which is aRelationship
attribute. The attribute gets updated via .../ngsi-ld/v1/entities/urn:ngsi-ld:Transport:001/attrs/cargo_ids with the following payload:The output logs of the context broker (see below) show that it perceives this update as an error, but the request reponse is still 204 (No Content) as with a valid request:
time=Tuesday 13 Jun 15:40:10 2023.295Z | lvl=ERROR | corr=N/A | trans=N/A | from=N/A | srv=N/A | subsrv=N/A | comp=Orion | op=pCheckAttribute.cpp[509]:objectCheck | msg=***** ERROR: Invalid JSON type - not a string: object (status: 400)
When checking the
cargo_ids
attribute after this request with aGET
, the following is returned:As you can see, the object value is now an empty string. I think that the
object
value should instead be updated to the given array?This is not the case when the attribute type is
Property
. However, updating an attribute of typeProperty
with an array with only one value inside of it (e.g. ["test"]), will result in the property value being set to the value within the array (e.g. "test") instead of an array with only one element inside of it. When the array has multiple values, the array is used as the value.Is this intentional?I am using version 1.2.1.
The text was updated successfully, but these errors were encountered: