|
Post by AMI_archerwen on Jan 10, 2022 9:53:18 GMT
Base on the spec, We need to follow below table (Please refer the attachment) to send a request for Multipart HTTP push updates. But if I provide the wrong content in a json file for "UpdateParameters", here are some examples, (1) property unknown {" TARGETS": ["/redfish/v1/UpdateService/FirmwareInventory/BMC"]} (2) invalid value type {"Targets": "/redfish/v1/UpdateService/FirmwareInventory/BMC"} (3) invalid value format {"Targets": ["/redfish/v1/UpdateService/FirmwareInventory/ bmc"]} Do we need use "Base" MessageRegistry to display? or We can defined a OEM MessageRegistry? Thanks, Archer. Attachments:
|
|
|
Post by jautor on Jan 10, 2022 19:25:16 GMT
Preference would be to use the Base message registry, as we have standard error messages for invalid data/format/etc. While the request/response payload may be different than other Redfish resources, the response format for an error case is the same. I'll take a look to make sure this is shown in the specification...
EDIT - and reading this again, it appears you are asking about what particular messages in Base should be used for these cases. We have messages in Base for both properties and action parameters. I want to discuss this with the group before providing guidance. Stay tuned...
Jeff
|
|
|
Post by AMI_archerwen on Jan 19, 2022 3:10:37 GMT
Hi, Is any update?
|
|
|
Post by jautor on Jan 19, 2022 17:05:59 GMT
The items in the JSON portion of the multipart payload are very similar to "action parameters" (since those items don't appear as properties in the normal resource response payload). So the "parameter" messages in the Base message registry are the most appropriate to use. Those include "ActionParameterValueFormatError" and "ActionParameterUnknown".
We'll add some clarifying language to the next release of the specification to show this, too.
Hope that helps,
Jeff
|
|
|
Post by AMI_archerwen on Jan 21, 2022 6:50:49 GMT
Another doubt might also related about the way to shows error message. If we provide a request body that contain multiple wrong property value/type or unknown property.
For example, If we PATCH Manages/Self. 1. property value format error: { "DateTime":"2020-07-16", "DateTimeLocalOffset":"0008:00" }
2. property value type error: { "DateTime": true, "DateTimeLocalOffset": false }
3. unknown property { "DATETIME": "2022-01-21T00:00:00+08:00", "DATETIMELOCALOFFEST": "+08:00" }
Is force or just recommend to show multiple error message? If can only shows single error, which property should be shows first?
Multiple Error Message: { "error": { "@message.ExtendedInfo": [ { "@odata.type": "#Message.v1_0_8.Message", "Message": "The value false for the property #/DateTimeLocalOffset is of a different type than the property can accept.", "MessageArgs": [ "false", "#/DateTimeLocalOffset" ], "MessageId": "Base.1.5.PropertyValueTypeError", "RelatedProperties": [ "#/DateTimeLocalOffset" ], "Resolution": "Correct the value for the property in the request body and resubmit the request if the operation failed.", "Severity": "Warning" }, { "@odata.type": "#Message.v1_0_8.Message", "Message": "The value false for the property #/DateTime is of a different type than the property can accept.", "MessageArgs": [ "false", "#/DateTime" ], "MessageId": "Base.1.5.PropertyValueTypeError", "RelatedProperties": [ "#/DateTime" ], "Resolution": "Correct the value for the property in the request body and resubmit the request if the operation failed.", "Severity": "Warning" } ], "code": "Base.1.5.GeneralError", "message": "A general error has occurred. See Resolution for information on how to resolve the error." } }
Single Error Message: { "error": { "@message.ExtendedInfo": [ { "@odata.type": "#Message.v1_0_8.Message", "Message": "The value false for the property #/DateTime is of a different type than the property can accept.", "MessageArgs": [ "false", "#/DateTime" ], "MessageId": "Base.1.5.PropertyValueTypeError", "RelatedProperties": [ "#/DateTime" ], "Resolution": "Correct the value for the property in the request body and resubmit the request if the operation failed.", "Severity": "Warning" } ] "code": "Base.1.5.PropertyValueTypeError", "message": "The value false for the property #/DateTime is of a different type than the property can accept." } }
Thanks, Archer.
|
|
|
Post by jautor on Jan 22, 2022 17:13:50 GMT
Since JSON payloads are un-ordered, there is no "first" property - and therefore the errors show in whatever order your implementation detects them. If multiple errors are detected, the service should certainly return messages for all errors in the payload. Otherwise, the client (human, not a program) is likely to retry with only some of the errors corrected, and then have to repeat the process - not a good experience.
But your implementation may reject the payload after the first error is detected, and there are definitely cases where that is the only choice (Invalid JSON for example).
But in general, the service should return all the information it has - if you detected multiple errors before aborting the request, there is no reason not to provide all of that information to the client.
Jeff
|
|
|
Post by AMI_archerwen on Jan 25, 2022 6:32:15 GMT
Got it. Thanks for the reply.
|
|
|
Post by AMI_archerwen on Feb 24, 2022 10:14:27 GMT
Hi Jeff,
Sorry for disturb, one more doubt. According the schema - UpdateService.v1_6_0, there has a definition for the "Targets" of "UpdateParameters".
"Targets": { "description": "An array of URIs that indicate where to apply the update image.", "format": "uri-reference", "items": { "type": [ "string", "null" ] }, "longDescription": "This property shall contain zero or more URIs that indicate where to apply the update image when using the URI specified by the MultipartHttpPushUri property to push a software image. These targets should correspond to SoftwareInventory instances or their related items. If this property is not present or contains no targets, the Service shall apply the software image to all applicable targets, as determined by the Service.", "readonly": true, "type": "array", "versionAdded": "v1_6_0" } }
We can see the longDescription said "If this property is not present or contains no targets, the Service shall apply the software image to all applicable targets, as determined by the Service." So base on my understanding, I assume the content of json file for key "UpdateParameters" like below. (1) not present {}
(2) no targets {"Targets": [] or [null]}
Above examples all can be accepted and didn't return 400. Am I correct?
|
|
|
Post by mraineri on Feb 24, 2022 13:56:32 GMT
Specifying the following is not allowed since the array members are not expected to be null. This is the equivalent of saying "There is one target, but I can't tell you what it is". This would result in a 400.
{ "Targets": [ null ] }
Either of the following bodies are legal and equate to "Apply the image where appropriate".
{ "Targets": [] }
{}
|
|