application/json-merge+patch support #1649
Labels
Azure.Core
The azure_core crate
Client
This issue points to a problem in the data-plane of the library.
design-discussion
An area of design currently under discussion and open to team and community feedback.
Mgmt
This issue is related to a management-plane library.
We need to figure out how to support
application/json-merge+patch
as described in our guidelines. We current plan to declare all fields asOption<T>
to support an unfortunately all too common case of a service specification being incongruent with the service: one requires a field while the other does not, for which we do an in-place update as needed to "correct" the spec. But to support json-merge+patch, we need to support serializing an explicitnull
to delete data for that field.Options discussed so far include the following, numbered only for easy reference and not by preference:
Given our agreement for
RequestContent<T>
and how rarely json-merge+patch support is needed, it may be sufficient to ask callers to pass raw JSON content (asBytes
orstr
).For those models used by operations that use
content-type: application/json-merge+patch
, we could define inazure_core
anOption<T>
-like tristate enum e.g.,We'd then implement
serde::Serialize
andserde::Deserialize
to handle the different variants much likeserde
implements support forOption<T>
.Null
would serializenull
much like excluding#[serde(skip_serializing_if = "Option::is_none")]
would do for an optional field ifNone
, or elide the field much like including the attribute would ifNone
.We should look at what other implementations are doing in this scenario.
The text was updated successfully, but these errors were encountered: