-
Notifications
You must be signed in to change notification settings - Fork 88
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
Task/add attribute metatadas and static attribute metadatas to jexl ctxt #1631
Conversation
Should context also need to be updated while calculating metadata expressions here? iotagent-node-lib/lib/services/ngsi/entities-NGSI-v2.js Lines 506 to 537 in 49f8550
|
Would be great to add a test under JEXL section here: iotagent-node-lib/test/functional/testCases.js Lines 987 to 997 in 46ac1d8
|
Differently from attribute calculation (where there is an order based in array index) in the case of metadata we don't have such array, so we have to be careful if the calculation of one metadata depends on another calculated metadata in the same attribute. Maybe this such be warned at documentation. |
doc/api.md
Outdated
Attribute metadata and Static Attribute metadata are available in the **context** under the following convention: | ||
`metadata.AttributeName.MetadataName` or `metadata.StaticAttributeName.MetadataName` in a similar way of defined for | ||
[Context Broker](https://github.com/telefonicaid/fiware-orion/blob/master/doc/manuals/orion-api.md#metadata-support) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems this paragraph is the only new thing in documentation, all the rest seems to be re-formatting.
@AlvaroVega could you confirm, pls?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Attribute metadata and Static Attribute metadata are available in the **context** under the following convention: | |
`metadata.AttributeName.MetadataName` or `metadata.StaticAttributeName.MetadataName` in a similar way of defined for | |
[Context Broker](https://github.com/telefonicaid/fiware-orion/blob/master/doc/manuals/orion-api.md#metadata-support) | |
Attribute metadata and Static Attribute metadata are available in the **context** under the following convention: | |
`metadata.<AttributeName>.<MetadataName>` or `metadata.<StaticAttributeName>.<MetadataName>` in a similar way of defined for | |
[Context Broker](https://github.com/telefonicaid/fiware-orion/blob/master/doc/manuals/orion-api.md#metadata-support) |
Using the <...>
syntax would make more explicit that they refer to actual names, different to metadata
which is a literal token.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it is
Fixed in c8778c7 |
Done in 344cb5c |
Done in a103f39 |
@@ -511,6 +535,11 @@ function sendUpdateValueNgsi2(entityName, originMeasures, originTypeInformation, | |||
} | |||
newAttrMeta['value'] = metaValueExpression; | |||
currentAttr.metadata[metaKey] = newAttrMeta; | |||
|
|||
//RE-Populate de JEXLcontext | |||
if (jexlctxt.metadata && jexlctxt.metadata[currentAttr.name]) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This if
clause checks if the metadata exits into the original jexl context but, in the case of new metadatas generated as a result of expressions, it would not be included. I think It should be appended to the jexlctxt even if it was not part previously of it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in 5da8640
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Co-authored-by: Fermín Galán Márquez <fgalan@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Issue #1630
Implemented having into account:
telefonicaid/fiware-orion#4600