|
Post by malbolge on Jan 26, 2020 22:53:59 GMT
Suppose I have a collection to return from my RDE toaster: <Property Name="BreadSlicesInserted" Type="Collection(Bakery.BreadSlice)" Nullable="false">
<Annotation Term="OData.Permissions" EnumMember="OData.Permission/Read"/>
<Annotation Term="OData.Description" String="An array of bread slices contained within the toasting slots of this toaster"/>
<Annotation Term="OData.LongDescription" String="This property shall contain an array of bread slices which are presently inserted into the slots of this toaster"/> </Property> Thanks to Jeff's reply a few topics back, I know there's an odata property called "count" redfish.dmtf.org/schemas/odata-v4.jsonIt appears as though it is pertinent to arrays ("collections"). Is this property mandatory or optional? If mandatory, does this mean I have to manually insert a BreadSlicesInserted@odata.count property? Do I have to do this just for collections, or are there any other places where this property should be inserted? If it's optional, what are the guidelines for what collections should and should not have an @odata.count?
|
|
|
Post by jautor on Jan 27, 2020 19:35:57 GMT
It is required for Resource Collections - that is, you shall have a "Members@odata.count" in those payloads.
But otherwise it's optional, and is supported by the Redfish Specification because that information was "useful" to OData clients. As the size of an array (which CSDL/OData calls a "collection" unfortunately) can be easily determined in many/most languages we'd expect clients to use, I don't see a benefit to including it on other array properties...
Jeff
|
|
|
Post by malbolge on Jan 28, 2020 13:53:34 GMT
It is required for Resource Collections - that is, you shall have a "Members@odata.count" in those payloads. But otherwise it's optional, and is supported by the Redfish Specification because that information was "useful" to OData clients. As the size of an array (which CSDL/OData calls a "collection" unfortunately) can be easily determined in many/most languages we'd expect clients to use, I don't see a benefit to including it on other array properties... Jeff Thanks Jeff, Is this convention formalized in any way? What I mean is, when I browse the CSDL for xCollection, I see a "Members" entry of type x. But neither in xCollection.xml, nor the base Resource.xml-> do I see anything that tells me I need to manually add a node "Members@odata.count". Is this formalized in any way (so that tooling can see it) or is it just a verbal convention and these need to be added manually? If so, which CSDL/schema contains a reference telling me I need a Members@odata.count property inserted?
|
|
|
Post by mraineri on Jan 28, 2020 20:32:24 GMT
In CSDL, payload annotations are implied based on the OData spec; it's not actually possible to define them in CSDL for specific properties as far as I know. The only traceability we have for this in Redfish is language in the spec making Members@odata.count mandatory, and also having our schema conversion tools explicitly add "Members@odata.count" to the JSON Schema and OpenAPI definitions.
|
|
|
Post by gericson on Jan 28, 2020 21:54:16 GMT
A bit of background information. (see: docs.oasis-open.org/odata/odata-json-format/v4.01/cs02/odata-json-format-v4.01-cs02.docx)The OData TC has improved the language describing when to include count. It's still a bit hard to read. Here is the nub... count(odata.count) is considered by OData to be control information and thus is handled a little differently from annotations. If the client (3.1.1) specifies metadata= none, minimal or full, related count information for a collection property or navigation property must be included if it was requested (via $count in the request URL or via include-annotations in the Prefer header). Caveat: This requirement is specific to OData and may not be adopted by Redfish.
|
|