iotagent-node-lib icon indicating copy to clipboard operation
iotagent-node-lib copied to clipboard

Attribute Default Value on Northbound side

Open gabrieledeluca opened this issue 7 years ago • 1 comments

During initialization of OCB entities, the library set some default attribute values based on type field. Here a snippet from deviceService.js file:

function getInitialValueForType(type) {
    switch (type) {
        case constants.LOCATION_TYPE:
            return constants.LOCATION_DEFAULT;
        case constants.DATETIME_TYPE:
            return constants.DATETIME_DEFAULT;
        default:
            return constants.ATTRIBUTE_DEFAULT;
    }
}

The value of constants.ATTRIBUTE_DEFAULT now is an empty string, what do you think about null value? In my opinion, semantically null is better: we are sensing something, so an empty string could be confused as real measure...

gabrieledeluca avatar Sep 30 '18 15:09 gabrieledeluca

null would be probably semantically better... but, what about backward compatibility? Existing clients of context information provided by IOTAgents may be using an empty string to detect default and changing it to null could break them.

fgalan avatar Oct 02 '18 10:10 fgalan