|
Post by kantvijay on Oct 27, 2016 5:34:44 GMT
Should we force user to send all the mandatory fields in the PATCH request along with what "Data" does user want to set?
|
|
|
Post by j2hilland on Oct 27, 2016 16:10:09 GMT
It doesn't need to - only the fields that you are changing. PUT would need all of them, but that's why we support PATCH so you can only change one property if you want.
|
|
|
Post by hramasub on Oct 28, 2016 5:38:54 GMT
Hence the "required" properties in the schema is applicable and need to be validated only PUT request ? i.e. even if the json schema "required" a set of properties to be mandatorily present in the body, it is acceptable for them not to be, if the body is in a PATCH request ?
Which section of the redfish specification talks about this behavior ?
|
|
|
Post by j2hilland on Oct 28, 2016 14:16:29 GMT
The specification is normative in nature and doesn't have a lot of educational material (hence the YouTube, this forum, mockups, etc). We know we need to get more examples of PUT/PATCH out there. So it depends on the nature of the property. If it's required & writeable, you probably would supply it on the PUT. Quite frankly, there are very few resources where PUT is expected (hence the support for PATCH).
So you have to draw this conclusion from: - "Properties that are required to be implemented by all services are annotated with the required annotation." That tells you that you always have to set it. Now, the implementation might supply that value (like for Id, for example) - Schema is annotated with Redfish.Readonly = true for non-writable properties. So if it's both Writable and Required, then the PUT would have it.
But more importantly, you have done a GET on the resource first. That tells the client which properties are supported by the implementation. So there may be more properties supported than are Required. And if there are those that are writable and not supplied on the PUT, the implementation can return an error.
So the best semantic for the client is probably to do the GET, modify what is needed and then do the PUT. An implementation is expected to ignore the non-writable properties and do the update. It can create an ErrorInfo with warnings on the non-writable ones but it isn't required.
Or just do a PATCH.
|
|