Post by alescouet on Apr 17, 2024 11:04:49 GMT
From what I gathered, both the Redfish and Swordfish specifications are
using OpenAPI version 3.0.1 and according to the OpenAPI specification version 3.0
it seems any siblings elements of a $ref reference are ignored:
Any sibling elements of a $ref are ignored. This is because $ref works
by replacing itself and everything on its level with the definition it
is pointing at. Consider this example:
In the second schema, the description and default properties are
ignored, so this schema ends up exactly the same as the referenced Date
schema.
Doesn't this mean the readOnly or nullable attributes would be ignored
for the properties using $ref as follows:
As a related question, considering these properties are read only,
and given the wording of the specification at
spec.openapis.org/oas/v3.0.1#schema-object:
Relevant only for Schema "properties" definitions. Declares the
property as “read only”. This means that it MAY be sent as part of a
response but SHOULD NOT be sent as part of the request. If the property
is marked as readOnly being true and is in the required list, the
required will take effect on the response only. A property MUST NOT be
marked as both readOnly and writeOnly being true. Default value is
false.
How should we specify values for these read only properties when creating
a new object?
The Swordfish v1.2.6 user guide suggests the following:
POST /redfish/v1/Storage/1/StoragePools/PrimaryPool/AllocatedVolumes
Headers: Content-type : application/json
Body:
Response: Response contains the details of the created volume.
HTTP status: 201 (Created)
However, the OpenAPI specification wording seems to imply Name and
RAIDType cannot appear as part of the request, given they are read only.
using OpenAPI version 3.0.1 and according to the OpenAPI specification version 3.0
it seems any siblings elements of a $ref reference are ignored:
Any sibling elements of a $ref are ignored. This is because $ref works
by replacing itself and everything on its level with the definition it
is pointing at. Consider this example:
components:
schemas:
Date:
type: string
format: date
DateWithExample:
$ref: '#/components/schemas/Date'
description: Date schema extended with a `default` value... Or not?
default: 2000-01-01
In the second schema, the description and default properties are
ignored, so this schema ends up exactly the same as the referenced Date
schema.
Doesn't this mean the readOnly or nullable attributes would be ignored
for the properties using $ref as follows:
Volume_v1_9_0_Volume:
additionalProperties: false
description: A container of data storage.
properties:
Name:
$ref: http://redfish.dmtf.org/schemas/v1/Resource.yaml#/components/schemas/Resource_Name
readOnly: true
RAIDType:
$ref: http://redfish.dmtf.org/schemas/swordfish/v1/Volume.yaml#/components/schemas/Volume_RAIDType
description: The RAID type of this volume.
nullable: true
readOnly: true
x-longDescription: This property shall contain the RAID type of the associated Volume.
x-versionAdded: v1_3_1
As a related question, considering these properties are read only,
and given the wording of the specification at
spec.openapis.org/oas/v3.0.1#schema-object:
Relevant only for Schema "properties" definitions. Declares the
property as “read only”. This means that it MAY be sent as part of a
response but SHOULD NOT be sent as part of the request. If the property
is marked as readOnly being true and is in the required list, the
required will take effect on the response only. A property MUST NOT be
marked as both readOnly and writeOnly being true. Default value is
false.
How should we specify values for these read only properties when creating
a new object?
The Swordfish v1.2.6 user guide suggests the following:
POST /redfish/v1/Storage/1/StoragePools/PrimaryPool/AllocatedVolumes
Headers: Content-type : application/json
Body:
{
"Name" : "MyVolume",
"CapacityBytes" : 1099511627776,
"RAIDType" : "RAID1"
}
Response: Response contains the details of the created volume.
HTTP status: 201 (Created)
However, the OpenAPI specification wording seems to imply Name and
RAIDType cannot appear as part of the request, given they are read only.