|
Post by JenHuang on Dec 24, 2020 7:13:54 GMT
As I checked how to represent the inaccessible data for property? It is very clear for the string and represent by null, but if type is "boolean", "integer", "number", how to represent it?
|
|
|
Post by mraineri on Jan 4, 2021 14:06:17 GMT
In the different schema languages, a property that can be null is expressed by: - CSDL: the property definition will not have the term Nullable="false".
- JSON Schema: the "type" term will contain "null" in the list.
- OpenAPI: the nullable term will be set to true.
In cases where null isn't allowed for a property, usually the forum doesn't expect the data to ever not be available. However, we have added null as an allowable type to properties over time as we've seen cases where a service might not know the value. Do you have a specific property and scenario in mind that we can discuss further?
|
|
|
Post by JenHuang on Jan 6, 2021 15:49:38 GMT
For more detail with my problem, I checked as the following description from redfish specification. If a value is unknown at the time of the operation, due to an internal error, the current resource state, or inaccessibility of the data then the value of null is an acceptable value if supported by the schema definition. General speak, all property might have trouble for internal error and there is only `null` for string. (my case is NTPServers, type is array) redfish.dmtf.org/schemas/v1/ManagerNetworkProtocol.v1_6_1.jsonHow to represent the data if internal error for other data type except string?
|
|
|
Post by mraineri on Jan 6, 2021 17:32:56 GMT
NTPServers does allow for null to be used in the array. The property itself cannot be null (OData does not allow for this), but the values in the array can be null.
So, if you had some sort of internal error getting your NTPServers, you can do something like this:
"NTPServers": [ null, null, null ] It would also be good to use the @message.ExtendedInfo annotation in your response to indicate the error conditions encountered.
|
|