Examples for typical questions on how to fine-tune the generated OpenAPI descriptions.
The examples here do not cover the full list of supported annotions.
NavigationRestrictions
annotations for the same entity set?RestrictedProperties
collection?To suppress both types of GET requests to an entity set, annotate it with
<Annotation Term="Capabilities.ReadRestrictions">
<Record>
<PropertyValue Property="Readable" Bool="false" />
</Record>
</Annotation>
To suppress only GET list requests to an entity set and still allow GET by-key, annotate it with
<Annotation Term="Capabilities.ReadRestrictions">
<Record>
<PropertyValue Property="Readable" Bool="false" />
<PropertyValue Property="ReadByKeyRestrictions">
<Record>
<PropertyValue Property="Readable" Bool="true" />
</Record>
</PropertyValue>
</Record>
</Annotation>
To suppress only GET by-key requests to an entity set and still allow GET list, annotate it with
<Annotation Term="Capabilities.ReadRestrictions">
<Record>
<PropertyValue Property="ReadByKeyRestrictions">
<Record>
<PropertyValue Property="Readable" Bool="false" />
</Record>
</PropertyValue>
</Record>
</Annotation>
<Annotation Term="Capabilities.NavigationRestrictions">
<Record>
<PropertyValue Property="Navigability" EnumMember="Capabilities.NavigationType/None" />
</Record>
</Annotation>
<Annotation Term="Capabilities.NavigationRestrictions">
<Record>
<PropertyValue Property="RestrictedProperties">
<Collection>
<Record>
<PropertyValue Property="NavigationProperty" NavigationPropertyPath="Foo" />
<PropertyValue Property="Navigability" EnumMember="Capabilities.NavigationType/None" />
</Record>
</Collection>
</PropertyValue>
</Record>
</Annotation>
<Annotation Term="Capabilities.NavigationRestrictions">
<Record>
<PropertyValue Property="RestrictedProperties">
<Collection>
<Record>
<PropertyValue Property="NavigationProperty" NavigationPropertyPath="Foo" />
<PropertyValue Property="ReadRestrictions">
<Record>
<PropertyValue Property="Readable" Bool="false" />
</Record>
</PropertyValue>
</Record>
</Collection>
</PropertyValue>
</Record>
</Annotation>
<Annotation Term="Capabilities.NavigationRestrictions">
<Record>
<PropertyValue Property="RestrictedProperties">
<Collection>
<Record>
<PropertyValue Property="NavigationProperty" NavigationPropertyPath="Foo" />
<PropertyValue Property="InsertRestrictions">
<Record>
<PropertyValue Property="Insertable" Bool="false" />
</Record>
</PropertyValue>
</Record>
</Collection>
</PropertyValue>
</Record>
</Annotation>
NavigationRestrictions
annotations for the same entity set?No, you have to combine all restrictions for an entity set into a single annotation with term Capabilities.NavigationRestrictions
.
RestrictedProperties
collection?No, you have to combine all restrictions for a navigation proeprty into a single record.