Uploaded image for project: 'OASIS Open Data Protocol (OData) TC'
  1. OASIS Open Data Protocol (OData) TC
  2. ODATA-818

Omit properties whose value is null or the $metadata-defined default value

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: V4.0_ERRATA02
    • Fix Version/s: V4.01_WD01
    • Component/s: JSON Format, Protocol
    • Labels:
    • Environment:

      Simplified Payload [Proposed]

    • Proposal:
      Hide

      Proposal:
      1) Add a new preference "odata.omit-values" which can have the value "nulls" or "defaults".
      2) if clients specify "omit-values=nulls" the service MAY omit null values. If the service omits null values, it MUST specify the preference-applied response with the "omit-values=nulls" response.
      3) If clients specify "omit-values=defaults" the service MAY omit defaults, including nulls for properties without defaults. In this case, nulls are included in the payload if there is a non-null default value defined. Note that, in this case, there service MAY omit nulls for properties without a default defined, but include properties in the payload that are the default value.
      4) If the client doesn't specify an OData-MaxVersion header the service is free to omit nulls
      5) Nulls and defaults are always included if changed in delta payloads
      6) Missing values in a PUT or POST are assumed to be default (current behavior). Missing values in PATCH are assumed to be untouched (current behavior). The response to a POST must include any values not set to their default. The response to a PUT/PATCH operation must include any properties whose values were changed as part of the operation.
      7) Services are always allowed to include nulls and defaults, regardless of the metadata level or preference specified.

      Show
      Proposal: 1) Add a new preference "odata.omit-values" which can have the value "nulls" or "defaults". 2) if clients specify "omit-values=nulls" the service MAY omit null values. If the service omits null values, it MUST specify the preference-applied response with the "omit-values=nulls" response. 3) If clients specify "omit-values=defaults" the service MAY omit defaults, including nulls for properties without defaults. In this case, nulls are included in the payload if there is a non-null default value defined. Note that, in this case, there service MAY omit nulls for properties without a default defined, but include properties in the payload that are the default value. 4) If the client doesn't specify an OData-MaxVersion header the service is free to omit nulls 5) Nulls and defaults are always included if changed in delta payloads 6) Missing values in a PUT or POST are assumed to be default (current behavior). Missing values in PATCH are assumed to be untouched (current behavior). The response to a POST must include any values not set to their default. The response to a PUT/PATCH operation must include any properties whose values were changed as part of the operation. 7) Services are always allowed to include nulls and defaults, regardless of the metadata level or preference specified.
    • Resolution:
      Show
      https://www.oasis-open.org/apps/org/workgroup/odata/download.php/59028/odata-v4.01-wd01-part1-protocol.docx https://www.oasis-open.org/apps/org/workgroup/odata/download.php/59030/odata-json-format-v4.01-wd01.docx

      Description

      Entities with many properties that are sparsely filled would benefit from optimizing the payload and omitting properties whose value is null.

      With odata.metadata=minimal the client can deduce from the context URL whether a property is missing due to not being part of the projection or due to being null.

      Maybe switch this on/off via a new preference in the Prefer header.

        Attachments

          Activity

            People

            • Assignee:
              handl Ralf Handl
              Reporter:
              handl Ralf Handl
            • Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: