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

Merging of restrictions annotations on entity sets and navigation property paths #321

Open
HeikoTheissen opened this issue Dec 19, 2024 · 3 comments

Comments

@HeikoTheissen
Copy link

Example: In tools/tests/annotations.xml, the resource path /ReadOnlySingleton/ReadOnlyMany is bound to the entity set TwoReadOnlySet

<NavigationPropertyBinding Path="ReadOnlyMany" Target="TwoReadOnlySet" />

which has ReadRestrictions

<Annotation Term="Capabilities.ReadRestrictions">
<Record>
<PropertyValue Property="Description" String="Supports read-list" />
<PropertyValue Property="LongDescription" String="Does not support any query options" />
</Record>
</Annotation>

But the "get summary" for this resource path is not taken from these ReadRestrictions but rather from the fallback-summary of the template operation-summary-description.

<xsl:call-template name="operation-summary-description">
<xsl:with-param name="restriction" select="$readRestrictions" />
<xsl:with-param name="fallback-summary">

The output is

"/ReadOnlySingleton/ReadOnlyMany": {
"get": {
"summary": "Get entities from related ReadOnlyMany",

and not

"/ReadOnlySingleton/ReadOnlyMany": { 
     "get": { 
         "summary": "Supports read-list",
         "description": "Does not support any query options",

General observation: Depending on the resource path, restrictions for operation-summary-description are only taken from the annotations

  • Capabilities.…Restrictions if the resource path is an entity set
  • Capabilities.NavigationRestrictions/RestrictedProperties/…Restrictions if the resource path contains a navigation property.

In the second case, other templates also consider Capabilities.…Restrictions of the bound entity set if there are no Capabilities.NavigationRestrictions/RestrictedProperties/…Restrictions for the navigation property. Why is the operation-summary-description template different?

@mikepizzo
Copy link

mikepizzo commented Jan 8, 2025

Question is: is it more meaningful to give a generic description of the relationship than to default to the description on the bound entity set.

@HeikoTheissen
Copy link
Author

HeikoTheissen commented Jan 9, 2025

OData-OpenAPI-v1.0 does not mention where the summary in a member of paths should come from. It gives only examples.

I prefer service-specific texts over generic texts, hence expect the following order:

  1. Service-specific Core.Description in navigation-path-specific Capabilities.NavigationRestrictions/RestrictedProperties/ReadRestrictions
  2. Service-specific Core.Description in entity-set-specific Capabilities.ReadRestrictions
  3. Generic summary "Get entities from related ..."

In the example # 2 exists but # 1 does not, I expect # 2 to be the summary.

But the current implementation considers only # 1 and # 3, hence # 3 is the summary.

@HeikoTheissen HeikoTheissen moved this to Open in OData TC Jan 9, 2025
@mikepizzo
Copy link

mikepizzo commented Jan 15, 2025

Assuming nav prop "customers" on a product:

"/Products/{Id}/Customers": {
"get": {
"summary": <...>,
"tags": [
"Products"
],

Order of preference:

  1. Read Restrictions for path
  2. Read Restrictions of entity set <=currently omitted
  3. Generated "Get entities from related "

We don't currently look at description of entity set/nav prop because we want to differentiate between read/write

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

No branches or pull requests

2 participants