-
Notifications
You must be signed in to change notification settings - Fork 2
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
FilterRestrictions & SortRestrictions on non-entity sets #2042
Comments
The capability annotations are not meant to be used on entity types, but only on annotation targets that start with an entity container, or embedded in a container child (entity set, function or action import). The idea behind this is that the same entity type can have different capabilities when it is addressed via different entity sets or containment navigation properties, or reused in different services via This has the following consequences for your questions:
I hope this answers your query. |
Thank you, that helps clarify. A couple follow up questions:
I'm not clear on what the annotations would look like. Is the below correct ?
Thank you |
Yes. The planned way to address this is described in #233.
Your first annotation is correct. The second annotation could be <Annotation Term="Org.OData.Capabilities.V1.NavigationRestrictions">
<Record>
<PropertyValue Property="RestrictedProperties">
<Collection>
<Record>
<PropertyValue Property="NavigationProperty"
NavigationPropertyPath="NavPropertyFromEntityTypeB" />
<PropertyValue Property="FilterRestrictions">
<Record>
<PropertyValue Property="NonFilterableProperties">
<Collection>
<PropertyPath>NavPropertyFromEntityTypeB/PropertyFromEntityTypeA</PropertyPath>
</Collection>
</PropertyValue>
</Record>
</PropertyValue>
</Record>
</Collection>
</PropertyValue>
</Record>
</Annotation> But the preferred (and more concise) way to annotate this is like in your first annotation, but with a navigation property path as target: <Annotations Target="MySchema.MyContainer/EntitySetB/NavPropertyFromEntityTypeB">
<Annotation Term="Org.OData.Capabilities.V1.FilterRestrictions">
<Record>
<PropertyValue Property="NonFilterableProperties">
<Collection>
<PropertyPath>PropertyFromEntityTypeA</PropertyPath>
</Collection>
</PropertyValue>
</Record>
</Annotation>
</Annotations> |
Thank you very much for the clarifications. |
Filter and Sort Restrictions annotations can only be applied to Entity Set or collection properties:
<Term Name="FilterRestrictions" Type="Capabilities.FilterRestrictionsType" Nullable="false" **AppliesTo="EntitySet Collection"**> <Annotation Term="Core.AppliesViaContainer" /> <Annotation Term="Core.Description" String="Restrictions on filter expressions" /> </Term>
Let's take the following use cases:
I have intentionally limited the use cases above to FilterRestrictions, but I have the same questions for SortRestrictions.
It seems to me it should be possible to apply the FilterRestrictions and SortRestrictions annotations for each Entity Type (and even Complex Type) to advertise to clients that some query options are not supported in certain situations. I understand there could be scenarios where specific entity sets have more or less restrictions, which the current model supports.
Any inputs would be greatly appreciated.
Thank you
The text was updated successfully, but these errors were encountered: