|
Post by rpajak on Nov 8, 2019 6:49:01 GMT
Hello, In many Json schemas there is "format" property, e.g in the UpdateService.v1_5_1.json in the MaintenanceWindowStartTime there is "format": "date-time", in the Chassis.v1_6_4.json in the definition of "Reset" there is "format": "uri-reference"
but the "format" property and its values are not defined anywhere in the Redfish specification or redfish.dmtf.org/schemas/v1/redfish-schema-v1.jsonWas the "format" missed in the documentation or redfish-schema-v1.json or should it be removed from the schemas? Regards, Radoslaw Pajak
|
|
|
Post by mraineri on Nov 8, 2019 15:03:57 GMT
|
|
|
Post by mraineri on Nov 8, 2019 20:43:01 GMT
I should also note that the "redfish-schema" file is an extension of the core JSON Schema vocabulary; since "$schema" has the value "http://json-schema.org/draft-07/schema#", this pulls in the referenced core JSON Schema definitions. This is where things like "format", "definitions", "properties", and other JSON Schema terms are defined.
|
|
fish
Guppy
Posts: 65
|
Post by fish on Nov 11, 2019 9:51:17 GMT
Hi, I was also a little confused about this, as it is not very easy to find why "format" is used in json schema. (mraineri gives good description above about where it is defined). But I think that reason for using the "format" is likely in how CSDL schema files are translated to JSON schema files, but these parts I donĀ“t think can be found in the specification document? (The CSDL files should be the origin and they are translated to JSON and openapi files.) Primitive data types (in CSDL files) are defined in specification (v 1.8.0) chapter 11.1.4.4, including type Edm.DateTimeOffeset, which I assume translate into some JSON string type but with "format": "date-time" added? And "format": "uri-reference" in JSON should in similar way originate from CSDL annotation term "OData.IsURL"? I hope that someone could confirm if this is correct or not.. I also think that this kind of mapping from CDSL to JSON could possibly be added to chapter 11.2 (JSON schema) in the specification to make it more clear? BR /Magnus
|
|
|
Post by mraineri on Nov 11, 2019 14:40:21 GMT
That's correct, the conversion tool will fill in "format" based on a few different things: - If the type is "Edm.DateTimeOffset", put in "date-time" - If the property contains "OData.IsURL", or is the "target" property in an action, put in "uri-reference" - If the property contains "Validation.Pattern", copy the pattern into "format"
We've definitely been behind with keeping the spec up to date with all of the terms we've been using in schema. I think it would be a good idea to add this an other terms that may be missing. It would go in both sections 9.2 (the general schema annotation listing) and section 11 (how they're used in the different schema languages).
|
|