orchestracities / auth-management-ui

An UI for Anubis and FIWARE-based platforms
https://master--62bcedd6cc1b1300eb9e1607.chromatic.com/
Apache License 2.0
0 stars 1 forks source link

NGSI entity validation #148

Closed c0c0n3 closed 1 year ago

c0c0n3 commented 1 year ago

Is your feature request related to a problem? Please describe.

We should validate the following when a user creates or edits an NGSI entity: id and type values, attribute names. In fact, both NGSI v2 and LD restrict what's allowed---though in slightly different ways. So a Context Broker may reject an entity the user created/edited if there's no validation in place. Also, Quantum Leap may fail to store entity data if type and attribute names can't be mapped cleanly to table/column names.

Describe the solution you'd like

Put in place some validation so the entity is valid under both NGSI v2 and LD. Also make sure Quantum Leap will be able to save entity data to the DB.

Validate the entity ID field by checking all the conditions below hold true:

Validate both the content of the entity type field and each attribute name by checking all the conditions below hold

Describe alternatives you've considered

Surely we could skip validation and just show the user whatever error Context Broker throws back. But the situation is trickier if you throw Quantum Leap in the mix. In fact, the user could create an entity that Context Broker accepts but Quantum Leap is then not able to store in the DB b/c e.g. column name restrictions. Now there's no easy way to tell the user something is wrong with the entity definition since the error would show up in Quantum Leap after Context Broker sent on the first entity---this is a service-to-service exchange where there's no user interaction.

Additional context

"Field syntax restrictions" section of the NGSI v2 spec

Ch 5 of the NGSI LD spec---especially section 5.2.4