Post by cactus on Jul 6, 2018 3:34:23 GMT
Current Redfish specification has the following statement:
Does that mean a service shall create default null value for properties that are supported but optional if they are not provided in the POST create request?
For example, the required properties of EventDestination are "Id", "Name", "Context", and "SubscriptionType", and the requiredOnCreate properties are "Destination", "Protocol", and "EventTypes".
If the EventService only implemented these properties, after a user POST create an EventDestination object, the object will look like the following:
{
"@redfish.Copyright":"Copyright 2014-2016 Distributed Management Task Force, Inc. (DMTF). All rights reserved.",
"@odata.context": "/redfish/v1/$metadata#EventDestination.EventDestination",
"@odata.id": "/redfish/v1/EventService/Subscriptions/1",
"@odata.type": "#EventDestination.v1_3_0.EventDestination",
"Id": "1",
"Name": "EventSubscription 1",
"Destination": "http://www.dnsname.com/Destination1",
"EventTypes": [
"Alert"
],
"Context": "ABCDEFGHJLKJ",
"Protocol": "Redfish",
"SubscriptionType": "RedfishEvent"
}
Now if the EventService also implemented optional properties "HttpHeaders", "MessageIds", and "OrignResources", but the user doesn't include these three properties in their POST create request, should the EventService create the EventDestinatin object as the following? And then users can PATCH HTTPHeaders, MessageIds, OriginResources later when they want.
{
"@redfish.Copyright":"Copyright 2014-2016 Distributed Management Task Force, Inc. (DMTF). All rights reserved.",
"@odata.context": "/redfish/v1/$metadata#EventDestination.EventDestination",
"@odata.id": "/redfish/v1/EventService/Subscriptions/1",
"@odata.type": "#EventDestination.v1_3_0.EventDestination",
"Id": "1",
"Name": "EventSubscription 1",
"Destination": "http://www.dnsname.com/Destination1",
"EventTypes": [
"Alert"
],
"Context": "ABCDEFGHJLKJ",
"Protocol": "Redfish",
"SubscriptionType": "RedfishEvent",
"HttpHeaders": null, <-- Add HttpHeaders with null even if it is not in the request?
"MessageIds: null, <-- Add MessageIds with null even if it is not in the request?
"OriginResources: null <-- Add OriginResources with null even if it is not in the request?
}
Or it is allowed that EventService can still create the object as the first example that doesn't have HttpHeaders, MessageIds, and OrignResources but users should still be able to PATCH HTTPHeaders, MessageIds, OriginResources later when they want?
It seems more reasonable that implemented optional properties shall appear with null value in the created object even if these optional properties are not in the request data.
If an implementation supports a property, it shall always provide a value for that property. If a value is unknown, then null is an acceptable values in most cases. Properties not returned from a GET operation shall indicate that the property is not currently supported by the implementation.
Does that mean a service shall create default null value for properties that are supported but optional if they are not provided in the POST create request?
For example, the required properties of EventDestination are "Id", "Name", "Context", and "SubscriptionType", and the requiredOnCreate properties are "Destination", "Protocol", and "EventTypes".
If the EventService only implemented these properties, after a user POST create an EventDestination object, the object will look like the following:
{
"@redfish.Copyright":"Copyright 2014-2016 Distributed Management Task Force, Inc. (DMTF). All rights reserved.",
"@odata.context": "/redfish/v1/$metadata#EventDestination.EventDestination",
"@odata.id": "/redfish/v1/EventService/Subscriptions/1",
"@odata.type": "#EventDestination.v1_3_0.EventDestination",
"Id": "1",
"Name": "EventSubscription 1",
"Destination": "http://www.dnsname.com/Destination1",
"EventTypes": [
"Alert"
],
"Context": "ABCDEFGHJLKJ",
"Protocol": "Redfish",
"SubscriptionType": "RedfishEvent"
}
Now if the EventService also implemented optional properties "HttpHeaders", "MessageIds", and "OrignResources", but the user doesn't include these three properties in their POST create request, should the EventService create the EventDestinatin object as the following? And then users can PATCH HTTPHeaders, MessageIds, OriginResources later when they want.
{
"@redfish.Copyright":"Copyright 2014-2016 Distributed Management Task Force, Inc. (DMTF). All rights reserved.",
"@odata.context": "/redfish/v1/$metadata#EventDestination.EventDestination",
"@odata.id": "/redfish/v1/EventService/Subscriptions/1",
"@odata.type": "#EventDestination.v1_3_0.EventDestination",
"Id": "1",
"Name": "EventSubscription 1",
"Destination": "http://www.dnsname.com/Destination1",
"EventTypes": [
"Alert"
],
"Context": "ABCDEFGHJLKJ",
"Protocol": "Redfish",
"SubscriptionType": "RedfishEvent",
"HttpHeaders": null, <-- Add HttpHeaders with null even if it is not in the request?
"MessageIds: null, <-- Add MessageIds with null even if it is not in the request?
"OriginResources: null <-- Add OriginResources with null even if it is not in the request?
}
Or it is allowed that EventService can still create the object as the first example that doesn't have HttpHeaders, MessageIds, and OrignResources but users should still be able to PATCH HTTPHeaders, MessageIds, OriginResources later when they want?
It seems more reasonable that implemented optional properties shall appear with null value in the created object even if these optional properties are not in the request data.