Skip to content

Conversation

@jason-fox
Copy link
Contributor

If an NGSI-LD value is sent with a null attribute, remove it from the NGSI-LD payload.

  • Update NGSI-LD entity processing
  • Update unit tests

If an NGSI-LD  value is sent with a null attribute, remove it  from the NGSI-LD payload.
@jason-fox
Copy link
Contributor Author

jason-fox commented Oct 13, 2021

Related to FIWARE/context.Orion-LD#919

For Orion-LD and the following workaround:

"value": {
    "@type": "Intangible",
    "@value": null
}

It is causing inconsistency between brokers. So it looks like this phrase will be tightened up, so the existing resolved to anull without being a null workaround will be made explicitly invalid by amending section 5.2.1

5.2.1 Introduction

Implementations shall support the data types defined by the clauses below. For each member defined by each data type
(including nested ones) a term shall be added to the Core @context, as mandated by clause 4.5.
None of the members described admit a null value

I suggested to @Neeraj-Nec and @naveennec that a PR could be raised to deal with this.

The fix is simple - if an NGSI-LD attribute value is parsed as null just set the whole attribute to undefined so it isn't sent.

const context = {
op: 'IoTAgentNGSI.Entities-LD'
};
const NGSIv2 = require('./entities-NGSI-v2');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add an entry in CHANGES_NEXT_RELEASE file about the fix/change done in this PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed 93a9686

Comment on lines -95 to +98
"prettier --parser markdown --tab-width 4 --print-width 120 --write --prose-wrap always",
"git add"
"prettier --parser markdown --tab-width 4 --print-width 120 --write --prose-wrap always"
],
"*.js": [
"prettier --config .prettierrc.json --write",
"git add"
"prettier --config .prettierrc.json --write"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you elaborate in this change, please?

Copy link
Contributor Author

@jason-fox jason-fox Oct 13, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since lint-staged@10.0.0 you can omit git add in the config - see https://github.com/okonet/lint-staged#v10

From v10.0.0 onwards any new modifications to originally staged files will be automatically added to the commit. If your task previously contained a git add step, please remove this. The automatic behaviour ensures there are less race-conditions, since trying to run multiple git operations at the same time usually results in an error.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the clarification. NTC

Copy link
Member

@fgalan fgalan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@fgalan fgalan merged commit ce49dc7 into telefonicaid:master Oct 14, 2021
@jason-fox jason-fox deleted the feature/null branch October 14, 2021 13:19
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

Successfully merging this pull request may close these issues.

2 participants