-
Notifications
You must be signed in to change notification settings - Fork 266
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
Implement a timestamp [pending: attribute creation/modification dates] #876
Comments
Thanks for the feedback! Actually, this is a planned feature since time ago, although implementing it in a slightly different way. Instead of including a |
Yes, I thought later after posting this feedback, NGSI would not allow such thing. But actually I already implemented exactly what you said for an API I'm working, which uses Orion for syncing. I figured out it would be impossible to set a timestamp for metadata since it's the bottom level, and using metadata pairs would not only be a VERY bad practice, but would eventually generate extra traffic and frustration. That disables metadatas for us though, but still attributes should be quite enough for the data storing. |
Finally, we have defered this to v2 API. This version uses a simplified API such as:
In which including
By default creDate/modDate are not returned (thus the JSON is simpler, in a general case). If the client wants to get the information, then some URI parameter has to be used. This is currently under discussion, but a possibility could be:
|
creDate and modeDate. That creates a new whole level of usability. Excellent work once again. |
Well... the issue has not been actually solved, only a solution proposed :) Thus, I'm reopening it. |
Entity creation and modification times implemented in PR #1829 (look the documentation pieces in that PR in order to see how it works at the end). Not sure yet what to do with attribute modification and creation times. By the moment, this issue remains opened while that piece of work/decission is pending. |
some comments: I think we need to adopt a naming schema for those properties which are automagically added by the implementation but which do not actually are part of the entity or the attribute themselves. That will help developers to distinguish them. One option is to use something "a la python" such as
and avoiding any kind of clash between user-defined data and these attributes. Another option, I'm more in favour, is to use '@dateCreated' '@dateModified' as names for these attributes which will be more aligned with our upcoming adoption of JSON-LD. In any case I think the name of the properties should be 'dateCreated' and 'dateModified' (to align to schema.org). With regards to attributes I think these could be part of the metadata associated to the attribute, but right now metadata layer is under discussion. So question mark here. With regards to the API to ask for their rendering I would suggest, for the sake of orthogonality, not to have any particular option but the regular patterns to do it. With the note that @dateCreated and @dateModified would not be rendered by default. /v2/entities?id=1234&attrs=@dateCreated,@dateModified I think right now we do not have the possibility to select partial content from a compound attribute but that is something could be considered as well. |
What about
and
with
I think the third option has less "syntactical awkwardness". Regarding orthogonality, we can use an alternative to
you will only get
meaning that we wan to include dateCreated in the response and that we want filter all except 2 attributes: temperature and dateCreated. Finally, a side-note about metadata. Metadata is under discussion only in the conext of the JSON-LD encoding discussion. I mean, the support and usage of metadata in the "regular" NGSIv2 API encodings is not under discussion. Thus, your comments about using metadata for rendering creation/modification dates about attributes do fully apply (this has been deferred to a post-0.28.0 version). |
Most of the functionality has been implemented in PR #2590. However, the support for filtering in date metadata has not been yet implemented/checked. The following .test should be used to implement that part. No aditional .test appart from them should be needed.
Currently they are emptu files. In order to complete them the same script that the one used in the following .tests should be used, but applying it to attribute dates as metadata (instead of entity dates as attributes):
|
The support for filtering in date metadata implemented in PR #2615 |
Ready for QA testing. |
Covered E2E in features/pepflows/010_pep2cbv2_virtualattributes.feature |
Issues in milestone QATestPendingE2ECovered are going to be closed (it is not realistic to think we would have people working on behave testing at the present moment). However, issue is labeled with QATestPending label in the case things change and we need to recover it. |
…ld-with-pointer-not-reference Hardening/get array field with pointer not reference
Implement an automatic timestamp (edit: of last action, or let a user set at update/append). That would save lives considering syncing.
The text was updated successfully, but these errors were encountered: