|
Post by malbolge on Mar 27, 2023 17:57:57 GMT
Coming, again, from an RDE perspective.
Most properties in a Resource eventually resolve to this or that CSDL file, which defines their format, whether they're mandatory or not - all sorts of useful stuff. Usually it's defined in the the same schema it's used, Sometimes it's an external schema, like Resource.
Some mandatory properties however don't have an associated CSDL schema - like @odata.id, and those are defined in JSON schemas exclusively. No CSDL to match.
Is there a CSDL for odata parameters? If not, why?
|
|
|
Post by mraineri on Mar 27, 2023 18:39:18 GMT
Anything with an "@" character are not typical properties. Specifically for anything starting with "@odata.", these properties are defined directly in the OData Specification and are not part of CSDL. There are also restrictions in CSDL due to the usage of "@" for special meanings; in CSDL, it's illegal to define a property containing "@" in its name. When we convert our schemas from CSDL to JSON Schema, we need to be aware of these specification-defined properties and insert them as needed. OData and CSDL tools are natively aware of these special properties, but anything downstream in JSON Schema and OpenAPI need explicit definitions.
|
|
|
Post by mraineri on Mar 27, 2023 19:00:05 GMT
We also describe the same notion in the Redfish Specification in the "Payload annotations" clause. Properties like @odata.id and @odata.type are technically payload annotations, but given how critical they are in responses, they are explicitly called out in JSON Schema and OpenAPI.
|
|
|
Post by malbolge on Mar 27, 2023 19:12:16 GMT
Thanks! It is a bit inconvenient that you can ALMOST get everything you need from just CSDLs. Is there like a JSON2CSDL converter, or at least a JSON-datatype-2-CSDL-EDM-datatype lookup table anywhere that I can run the odatav4.json thtough?
|
|
|
Post by mraineri on Mar 27, 2023 19:34:40 GMT
No, we don't have such a tool; we draft everything in CSDL and created tooling to convert to other formats (but not the reverse).
|
|
|
Post by malbolge on Mar 27, 2023 20:36:50 GMT
Okay, but if there's like an "count": { "type": "integer", "readonly": true, "description": "The number of items in a collection.", "longDescription": "The value of this property shall be an integer representing the number of items in a collection." },
What does the "integer" map to in EDM types? An Edm.Int64? An Edm.SByte? Or is it an inherent Redfish trait that Schema EDM types are just python-like suggestions?
|
|
|
Post by mraineri on Mar 27, 2023 21:01:13 GMT
|
|
|
Post by malbolge on Mar 27, 2023 22:01:46 GMT
Thanks! So it seems like odata properties do have a specific mapping to EDM types, and as a result, all Redfish properties can be assigned an EDM type. This is awesome! The capacity to define 99% of Redfish EDM types/descriptions/RO/RW through CSDL parsing, while the remaining 1% odata properties needing exceptional hardcoding and JSON parsing seems.. oddly inelegant though.
|
|