Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Context fragment of contained single entity #2009

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

HeikoTheissen
Copy link
Contributor

Fixes #2000

Copy link
Contributor

@ralfhandl ralfhandl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1, only one comment

odata-protocol/10 Context URL.md Outdated Show resolved Hide resolved
Copy link
Contributor

@ralfhandl ralfhandl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I really think that the text will be easier if we define

  • {entity-set} is the name of an entity set or path to a collection-valued containment navigation property
  • {single-entity} is the name of a singleton or path to a single-valued containment navigation property

and then use these definitions in the text below

odata-protocol/10 Context URL.md Outdated Show resolved Hide resolved
Copy link
Contributor

@ralfhandl ralfhandl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good so far. Only nit is that {singleton} also appears in

  • section 10.8 Projected Entity
  • section 10.10 Expanded Entity

and should be replaced with {single-entity}

ralfhandl
ralfhandl previously approved these changes Oct 10, 2024
@HeikoTheissen
Copy link
Contributor Author

HeikoTheissen commented Oct 24, 2024

Sections 10.2, 10.3 and 10.4. form a triplet for the cases

  • collection of entities
  • one entity from a collection
  • a singleton (entity) that is not contained in a collection. In this case, the {type-name} variant never occurs. A {/type-name} can occur, but is not mentioned in the text.

But in later sections, this triplet pattern is violated. There are no sections for "Derived Singleton", "Projected Singleton" or "Expanded Singleton". And "Operations Results" and "Delta Payload" lump all three cases together.

Consider describing the triplet as orthogonal to the other ingredients (derivation, projection, expansion, operation, delta).

Type of value Collection of entities Entity in collection Singleton outside collection
Value if entity set (maybe implicit) is known #{entity-collection} #{entity-collection}/$entity n/a
Value if entity set (maybe implicit) is unknown #Collection({type-name}) #{type-name} #{entity-singleton}
Derived/projected value #{entity-collection}{/type-name}{select-list} #{entity-collection}{/type-name}{select-list}/$entity #{entity-singleton}{/type-name}{select-list}

What if the entity set of collection of derived values is not known (composable function w/o entity set path followed by a type cast segment)?

Collection({type-name}){/type-name-from-request}
Collection({type-name-from-request})

@ralfhandl
Copy link
Contributor

We decided to merge sections 10.13 to 10.15 and get rid of 10.16

@HeikoTheissen
Copy link
Contributor Author

Example ##ex: resource URL and corresponding context URL
```
http://host/service/Customers(1)/Addresses
http://host/service/$metadata#Customers(1)/Addresses
```

If there is a special context URL format for a property of a specific entity, why not also for a specific entity in its entirety?

http://host/service/Customers(1)
http://host/service/$metadata#Customers/$entity  /* context URL as specified */
http://host/service/$metadata#Customers(1) /* why not this? */

@ralfhandl
Copy link
Contributor

If there is a special context URL format for a property of a specific entity, why not also for a specific entity in its entirety?

10 Context URL claims that

The context URL makes response payloads “self-contained”, allowing a recipient to retrieve metadata, resolve references, and construct canonical links omitted from response payloads in certain optimized formats.

4.5.8 Control Information: id (odata.id) requires that

The id control information MUST appear in responses if [...] any of a non-transient entity’s key fields are omitted from the response [...]

This means that a (JSON) representation of a full or projected entity has enough information to construct the canonical URL from the entity set name alone included in the context URL, whereas for properties of an entity the context URL in addition needs to include the key values. Same for "implicit contained entity sets" which also include the key values of the container(s).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Context URL of single-valued containment navigation property
2 participants