Skip to content

Commit

Permalink
Clarify ordering constraints of deleted entity in JSON payload
Browse files Browse the repository at this point in the history
  • Loading branch information
mikepizzo committed Oct 16, 2024
1 parent c92ca2b commit 22180d1
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 10 deletions.
10 changes: 6 additions & 4 deletions docs/odata-json-format/odata-json-format.html
Original file line number Diff line number Diff line change
Expand Up @@ -399,12 +399,13 @@ <h2 id="11-changes-from-earlier-versions"><a id="ChangesfromEarlierVersions" hre
<td><a href="https://github.com/oasis-tcs/odata-specs/issues/456">456</a></td>
</tr>
<tr class="odd">
<td><a href="#ActionInvocation">Section 18</a></td>
<td>Allow common expressions in action payloads</td>
<td><a href="https://github.com/oasis-tcs/odata-specs/issues/341">341</a></td>
<td><a href="#DeletedEntity">Section 15.3</a></td>
<td><code>type</code> control information, if present, must come immediately after <code>removed</code></td>
<td></td>
</tr>
</tbody>
</table>
<p><a href="https://github.com/oasis-tcs/odata-specs/issues/1985">1985</a> <a href="#ActionInvocation">Section 18</a>| Allow common expressions in action payloads| <a href="https://github.com/oasis-tcs/odata-specs/issues/341">341</a></p>
</details>
<details open><summary>
<h2 id="12-glossary"><a id="Glossary" href="#Glossary">1.2 Glossary</a></h2>
Expand Down Expand Up @@ -634,6 +635,7 @@ <h2 id="45-payload-ordering-constraints"><a id="PayloadOrderingConstraints" href
<p>To support streaming scenarios the following payload ordering constraints have to be met:</p>
<ul>
<li>If present, the <code>context</code> control information MUST be the first property in the JSON object.</li>
<li>For 4.01 deleted entities, the <code>@removed</code> control information MUST appear after <code>context</code>, if present, and before any other property or control information.</li>
<li>The <code>type</code> control information, if present, MUST appear next in the JSON object.</li>
<li>The <code>id</code> and <code>etag</code> control information MUST appear before any property, property annotation, or property control information.</li>
<li>All annotations or control information for a structural or navigation property MUST appear as a group immediately before the property itself. The one exception is the <a href="#ControlInformationnextLinkodatanextLink"><code>nextLink</code></a> of a collection which MAY appear after the collection it annotates.</li>
Expand Down Expand Up @@ -1477,7 +1479,7 @@ <h2 id="153-deleted-entity"><a id="DeletedEntity" href="#DeletedEntity">15.3 Del
<p>In OData 4.01 payloads the deleted-entity object MUST include the following properties, regardless of the specified <a href="#ControllingtheAmountofControlInformationinResponses"><code>metadata</code></a> value:</p>
<ul>
<li><p>Control information <a href="#ControlInformationremovedodataremoved"><code>removed</code></a>, whose value is an object that MAY contain a property named <code>reason</code>. If present, the value of <code>reason</code> MUST be either <code>deleted</code> if the entity was deleted (destroyed), or <code>changed</code> if the entity was removed from membership in the result either due to change in value such that the entity no longer matches the defining query or because the entity was removed from the collection. The object MAY include <a href="#InstanceAnnotations">annotations</a>, and clients SHOULD NOT error due to the presence of additional properties that MAY be defined by future versions of this specification. For <a href="#PayloadOrderingConstraints">ordered payloads</a>, the control information <a href="#ControlInformationremovedodataremoved"><code>removed</code></a> MUST immediately follow the <a href="#ControlInformationcontextodatacontext"><code>context</code></a> control information, if present, otherwise it MUST be the first property in the deleted entity.</p></li>
<li><p>Control information <a href="#ControlInformationidodataid"><code>id</code></a> or all of the entity’s primary key fields. The <code>id</code> control information MUST appear if any of the entity’s primary key fields are omitted from the response <em>or</em> the entity-id is not identical to the canonical URL of the entity. When using a delta payload in an <a href="#UpdateaCollectionofEntities">update request</a>, an <a href="https://github.com/oasis-tcs/odata-vocabularies/blob/main/vocabularies/Org.OData.Core.V1.md#AlternateKeys">alternate key</a> (see <em>Alternate Keys</em> in <a href="#ODataURL">OData-URL</a>) MAY be used in place of the entity’s primary key. A delta response from an update request using alternate keys SHOULD include all fields of the alternate key used in the request, in which case it MAY omit the <code>id</code> control information and other primary key fields. For <a href="#PayloadOrderingConstraints">ordered payloads</a>, the control information <code>id</code>, if present, MUST immediately follow the control information <a href="#ControlInformationremovedodataremoved"><code>removed</code></a>.</p></li>
<li><p>Control information <a href="#ControlInformationidodataid"><code>id</code></a> or all of the entity’s primary key fields. The <code>id</code> control information MUST appear if any of the entity’s primary key fields are omitted from the response <em>or</em> the entity-id is not identical to the canonical URL of the entity. When using a delta payload in an <a href="#UpdateaCollectionofEntities">update request</a>, an <a href="https://github.com/oasis-tcs/odata-vocabularies/blob/main/vocabularies/Org.OData.Core.V1.md#AlternateKeys">alternate key</a> (see <em>Alternate Keys</em> in <a href="#ODataURL">OData-URL</a>) MAY be used in place of the entity’s primary key. A delta response from an update request using alternate keys SHOULD include all fields of the alternate key used in the request, in which case it MAY omit the <code>id</code> control information and other primary key fields. For <a href="#PayloadOrderingConstraints">ordered payloads</a>, the control information <code>id</code>, if present, MUST appear following the control information <a href="#ControlInformationremovedodataremoved"><code>removed</code></a> and, if present, <a href="#ControlInformationtypeodatatype"><code>type</code></a>, and before any other properties or control information.</p></li>
</ul>
<p>For full metadata the <a href="#ControlInformationcontextodatacontext"><code>context</code></a> control information MUST be included. It also MUST be included if the entity set of the deleted entity cannot be determined from the surrounding context.</p>
<p>The deleted-entity object MAY include additional properties of the entity, as well as <a href="#InstanceAnnotations">annotations</a>, and MAY include related entities, related deleted entities, or a delta or full representation of a related collection of entities, to represent related entities that have been modified or deleted.</p>
Expand Down
9 changes: 6 additions & 3 deletions docs/odata-json-format/odata-json-format.md
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,8 @@ Section | Feature / Change | Issue
[Section 4.6.8](#ControlInformationidodataid)| Transient entities can be identifiable| [1928](https://github.com/oasis-tcs/odata-specs/issues/1928)
[Section 4.6.12](#ControlInformationmediaodatamedia)| `mediaContentType` can be `null`| [536](https://github.com/oasis-tcs/odata-specs/issues/536)
[Section 7](#StructuralProperty), [Section A.2](#InformativeReferences)| Removed reference to obsolete version of GeoJSON| [456](https://github.com/oasis-tcs/odata-specs/issues/456)
[Section 15.3](#DeletedEntity) | `type` control information, if present, must come immediately after `removed` |
[1985](https://github.com/oasis-tcs/odata-specs/issues/1985)
[Section 18](#ActionInvocation)| Allow common expressions in action payloads| [341](https://github.com/oasis-tcs/odata-specs/issues/341)

## <a id="Glossary" href="#Glossary">1.2 Glossary</a>
Expand Down Expand Up @@ -711,6 +713,7 @@ constraints have to be met:

- If present, the `context` control information MUST be the first
property in the JSON object.
- For 4.01 deleted entities, the `@removed` control information MUST appear after `context`, if present, and before any other property or control information.
- The
`type` control information, if present, MUST appear next in
the JSON object.
Expand Down Expand Up @@ -2300,9 +2303,9 @@ following properties, regardless of the specified
MAY be used in place of the entity's primary key. A delta response from an update request using alternate keys SHOULD include all fields of the alternate key used in the request, in which case it
MAY omit the `id` control information and other primary key fields. For [ordered
payloads](#PayloadOrderingConstraints), the control information
`id`, if present, MUST immediately follow the control
information
[`removed`](#ControlInformationremovedodataremoved).
`id`, if present, MUST appear following the control information
[`removed`](#ControlInformationremovedodataremoved) and, if present, [`type`](#ControlInformationtypeodatatype), and before any other
properties or control information.

For full metadata the
[`context`](#ControlInformationcontextodatacontext)
Expand Down
3 changes: 3 additions & 0 deletions odata-json-format/1 Introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ Transient entities can be identifiable|
[Section ##StructuralProperty], [Section ##InformativeReferences]|
Removed reference to obsolete version of GeoJSON|
[456](https://github.com/oasis-tcs/odata-specs/issues/456)
[Section ##DeletedEntity] |
`type` control information, if present, must come immediately after `removed` |
[1985](https://github.com/oasis-tcs/odata-specs/issues/1985)
[Section ##ActionInvocation]|
Allow common expressions in action payloads|
[341](https://github.com/oasis-tcs/odata-specs/issues/341)
Expand Down
7 changes: 4 additions & 3 deletions odata-json-format/15 Delta Payload.md
Original file line number Diff line number Diff line change
Expand Up @@ -211,9 +211,10 @@ following properties, regardless of the specified
MAY be used in place of the entity's primary key. A delta response from an update request using alternate keys SHOULD include all fields of the alternate key used in the request, in which case it
MAY omit the `id` control information and other primary key fields. For [ordered
payloads](#PayloadOrderingConstraints), the control information
`id`, if present, MUST immediately follow the control
information
[`removed`](#ControlInformationremovedodataremoved).
`id`, if present, MUST appear following the control information
[`removed`](#ControlInformationremovedodataremoved) and, if present,
[`type`](#ControlInformationtypeodatatype), and before any other
properties or control information.

For full metadata the
[`context`](#ControlInformationcontextodatacontext)
Expand Down
2 changes: 2 additions & 0 deletions odata-json-format/4 Common Characteristics.md
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,8 @@ constraints have to be met:

- If present, the `context` control information MUST be the first
property in the JSON object.
- For 4.01 deleted entities, the `@removed` control information MUST appear
after `context`, if present, and before any other property or control information.
- The
`type` control information, if present, MUST appear next in
the JSON object.
Expand Down

0 comments on commit 22180d1

Please sign in to comment.