-
Type: Bug
-
Status: Open
-
Priority: Major
-
Resolution: Unresolved
-
Affects Version/s: V4.01_OS
-
Fix Version/s: V4.01_ERRATA01
-
Component/s: Protocol
-
Labels:None
-
Proposal:
A function can return a collection of an entity where that entity does not have a key defined. Keys are only required for [entity sets and multivalued navigation properties](https://docs.oasis-open.org/odata/odata-csdl-xml/v4.01/odata-csdl-xml-v4.01.html#_Toc38530354):
> In order to be specified as the type of an entity set or a collection-valued containment navigation property, the entity type MUST either specify a key or inherit its key from its base type.
[The standard](https://docs.oasis-open.org/odata/odata/v4.01/odata-v4.01-part1-protocol.html#sec_EntityIdsandEntityReferences) also says:
> entities are also uniquely identified by a durable, opaque, globally unique entity-id
> ...
> Services are strongly encouraged to use the canonical URL for an entity
So, my conclusion is that an entities returned in a collection by a function should have entity-ids. However, looking at how to create the canonical URL for an entity, the [standard says this](https://docs.oasis-open.org/odata/odata/v4.01/odata-v4.01-part2-url-conventions.html#sec_CanonicalURL):
> the canonical form of an absolute URL identifying a non-contained entity is formed by adding a single path segment to the service root URL. The path segment is made up of the name of the entity set associated with the entity followed by the key predicate identifying the entity within the collection.
It appears that an assumption is made that non-contained entities must exist within an entity set. However, entities that only exist as the result of a function may not have any entity set defined. So, it appears that there is no entity-id for the entities returned from a function, despite the standard declaring that entities have a durable, opaque, globally unique entity-id which can be exposed by following the canonical URL conventions.