Vocabularies
Vocabularies provide the ability to annotate metadata as well as instance data, and define a powerful extensibility point for OData.
- Metadata annotations can be used to define additional characteristics or capabilities of a metadata element, such as a service, entity type, property, function, action or parameter. For example, a metadata annotation may define ranges of valid values for a particular property.
- Instance annotations can be used to define additional information associated with a particular result, entity, property, or error; for example whether a property is read-only for a particular instance.
Annotations that apply across instances should be specified within the metadata. Where the same annotation is defined at both the metadata and instance level, the instance-level annotation should override the annotation specified at the metadata level.
Some things to keep in mind about vocabularies:
- A vocabulary is a namespace containing terms where each term is a named metadata extension for an OData service
- Anyone can define a vocabulary that is specific to a scenario; more commonly used terms can be added to shared vocabularies such as the OData core vocabularies
- A service should not require a client to interpret annotations
- Metadata annotations appear in $metadata whereas instance annotations appear in the actual payload
To get started with OData Vocabularies, please refer to Vocabulary components