Post by slotain on Nov 2, 2021 20:32:20 GMT
TLDR; Is there a programmatic way to determine the URI path that we see in DSP2046_2021 Redfish Resource and Schema Guide, for example, can I compute the the @odata.id, including the {Curly_Braces} part, by using only the schema. Let's say for Fan 1.1.0, can I compute this value that I found in the DSP2046?
I'm writing changes to the generator in Redfish-Interface-Emulator/infragen/generate_template.py to suit my purpose of generating a template JSON that is fully populated with jinja replacement strings like "{{property}}" for some `property` in the schema.
This generate_template.py program will crawl the web for schema files on redfish.org/schemas and prompt the user for input about how to fill in a generated template.
When the generator asks about an @odata.id value, it just asks for a string. So basically I'm wondering how to know where in the spec a certain @odata.id attribute should be populated. And hopefully there's a place in the schema that I can read from this python file to compute this.
For example, if I look in the DSP2043_2021.2 Mockups Bundle, and I find a fan's mockup JSON, I see an attribute for "@odata.id": "/redfish/v1/Chassis/1U/ThermalSubsystem/Fans/Bay1",
Obviously, the Fan implements the Fan resource schema underneath the Fans collection, and Bay1 is just an identifier that could be replaced with {{id}}. I can, using the generator, create a template string to easily replace that.
Does the schema (specifically schema files under DSP8010, which are published online at redfish.org/schemas) define the full URI path with curly braces and all?
For example, Chassis is a root-level collection, but I don't see any enforcement Chassis resources inside that collection as defined in the schema require that @odata.id have a substring "/redfish/v1/Chassis/" in it which some Redfish implementation appends {ChassisId} at the end.
6.39.2 URIs
/redfish/v1/Chassis/{ChassisId}/ThermalSubsystem/Fans/{FanId}
/redfish/v1/Chassis/{ChassisId}/ThermalSubsystem/Fans/{FanId}
I'm writing changes to the generator in Redfish-Interface-Emulator/infragen/generate_template.py to suit my purpose of generating a template JSON that is fully populated with jinja replacement strings like "{{property}}" for some `property` in the schema.
This generate_template.py program will crawl the web for schema files on redfish.org/schemas and prompt the user for input about how to fill in a generated template.
When the generator asks about an @odata.id value, it just asks for a string. So basically I'm wondering how to know where in the spec a certain @odata.id attribute should be populated. And hopefully there's a place in the schema that I can read from this python file to compute this.
For example, if I look in the DSP2043_2021.2 Mockups Bundle, and I find a fan's mockup JSON, I see an attribute for "@odata.id": "/redfish/v1/Chassis/1U/ThermalSubsystem/Fans/Bay1",
Obviously, the Fan implements the Fan resource schema underneath the Fans collection, and Bay1 is just an identifier that could be replaced with {{id}}. I can, using the generator, create a template string to easily replace that.
Does the schema (specifically schema files under DSP8010, which are published online at redfish.org/schemas) define the full URI path with curly braces and all?
For example, Chassis is a root-level collection, but I don't see any enforcement Chassis resources inside that collection as defined in the schema require that @odata.id have a substring "/redfish/v1/Chassis/" in it which some Redfish implementation appends {ChassisId} at the end.