OData Annotations

OData Annotations

The metadata document exposed by the REST API includes additional information in the form of OData annotations.
These annotations provide useful metadata for localization, validation, and user interface purposes.


Supported Annotation Terms

Term Description
Org.OData.Validation.V1.StringLength Indicates the maximum allowed character length. Applies to string properties only.
Org.OData.Display.V1.DisplayName Specifies the display name of a property. Useful for labeling fields in user interfaces.
Org.OData.Domain.V1.CodeType Applies to code properties only. Names the code type to pass to the Codes endpoint, and tells whether that code type is hierarchical. See Discovering Code Types.

Example $metadata Response

HTTP/1.1 200 OK
Content-Length: 1548
Content-Type: application/xml
OData-Version: 4.0
<?xml version="1.0" encoding="utf-8"?>
<edmx:Edmx Version="4.0" xmlns:edmx="http://docs.oasis-open.org/odata/ns/edmx">
  <edmx:DataServices>
    <Schema Namespace="PROLIN.Web.OData.Model" xmlns="http://docs.oasis-open.org/odata/ns/edm">
      <EntityType Name="ServiceRequest">
        <Property Name="Solution" Type="Edm.String">
          <Annotation Term="Org.OData.Display.V1.DisplayName" String="Solution" />
          <Annotation Term="Org.OData.Validation.V1.StringLength" Int="4000" />
        </Property>
        ...
      </EntityType>
    </Schema>
  </edmx:DataServices>
</edmx:Edmx>
NoteNote

This example is illustrative and shortened. Retrieve $metadata from your own server for the actual content; see Service Metadata Document.


Practical Use

These annotations can be used by:

  • Developers to dynamically generate form fields and labels.
  • Validation frameworks to enforce field constraints (e.g., maximum string length).
  • Localization layers to present user-friendly property names in different languages.

💡 Tip:
When integrating with UI frameworks or custom API clients, leverage the OData annotations to dynamically adapt your interface without hardcoding validation or display labels.

Back to top