|
Post by mharishm on Sept 2, 2021 17:33:52 GMT
Logically all this 3 properties (Voltages, PowerControl and PowerSupplies) of power schema(2019.4) are of array type and also as per schema these 3 properties are not mandatory properties (not listed under required attribute in schema).
There are situation where we cannot get the PowerControl values. In this situation is it ok not to have PowerControl property in the response just like below
{ "Voltages":[..], "Voltages@odata.count":10, "PowerSupplies":[..], "PowerSupplies@odata.count":5, }
Or, do we need to display empty array object without any array member as shown below
{ "PowerControl":[], "PowerControl@odata.count":0, "Voltages":[..], "Voltages@odata.count":10, "PowerSupplies":[..], "PowerSupplies@odata.count":5, }
Which approach is valid?
|
|
|
Post by jautor on Sept 3, 2021 2:37:52 GMT
The Redfish approach is to only include properties in the payload that your product actually supports. These arrays are good examples - if your product does not report "Voltages", you should not populate that property at all. An empty array does not serve any purpose, and is probably more likely to cause an issue for client software.
Note also that if you are doing a new implementation, we would highly recommend you use the PowerSubsystem and PowerSupply schemas - the "Power" schema has been deprecated and is not recommended for new development. However, compatibility with existing clients or consistency with other product implementations may require it. In those cases we would recommend implementing both the Power and PowerSubsystem schemas to provide a migration path to the new (and much improved) schemas.
Jeff
|
|