---
schema_version: "1"
id: d3beffa9a6f99e814aecfe1c2f9f91611e6bdf1f0180e8af8f5dd1e6d3399ce9
title: Defining EDM with RAML in APIkit for OData v2
collection: mulesoft
version: current
locale: en-us
portal_url: https://docs.salesforce.com/mulesoft/current/en-us/apikit/latest/apikit-odatav2-api-reference.md
canonical_url: https://docs.mulesoft.com/apikit/latest/apikit-odatav2-api-reference
source_site: docs.mulesoft.com
content_type: documentation
content_hash: 68fd03a2a14d0d2edbe03eb47a9f7a4410e11da95bcb1741e93a4799a75bc7c5
description: MuleSoft Documentation Site
release: 4.x
latest: true
---
---
product: APIkit
version: 4.x
is-latest-version: true
---

# Defining EDM with RAML in APIkit for OData v2

> For the full documentation index, see: https://docs.mulesoft.com/llms.txt

Define your OData Entity Data Model (EDM) in RAML so APIkit for OData v2 can build the `odata.raml`
library the extension uses to scaffold flows. Model entities with EDM-compatible types, keys, and
annotations that match the requirements below. After scaffolding with the APIkit OData extension,
implement the generated endpoints with your business logic.

## Entity Data Model

The APIkit OData Extension builds the OData API based on an `odata.raml` file that describes the
OData entity data model (EDM) using supported EDM types. The `odata.raml` file is a RAML Library.
Each DataType represents an EntityModel. For example:

```yaml
#%RAML 1.0 Library
uses:
  odata: !include libraries/odata.raml
types:
  Employee:
    properties:
      id:
        type: integer
        (odata.key): bool
        (odata.nullable): bool
      name:
        type: string
```

Annotate at least one of the properties on each entity using the annotation (odata.key).

These annotations pertain to each property:

```yaml
(odata.precision): int
(odata.scale): int
```

Use the optional (odata.remote) annotation to provide the name of the entity in the remote data
source:

```yaml
types:
  Employee:
  (odata.remote): SAP_VBAK
    properties:
      ...
```

## Supported EDM Data Types

The APIkit OData Extension supports all EDM types except Edm.Sbyte. In your model, you define the
RAML types that map to the EDM type shown in the following list of supported EDM types:

### Edm.String

The String type represents fixed or variable length character data.

RAML `type: string`

### Edm.Boolean

The Boolean data type is used to represent the mathematical concept of binary valued logic. There
are no applicable facets for this type.

RAML `type: boolean`

### Edm.Double

The Double type represents a floating point number with 15 digits precision that can represent
values with an approximate range of ± 2.23e -308 through ± 1.79e +308.

RAML `type: number`

### Edm.Single

The Single type represents a floating point number with seven digits precision that can represent
values with an approximate range of ± 1.18e -38 through ± 3.40e +38

RAML `type: number`

RAML `format: float`

### Edm.Binary

The binary data type is used to represent fixed or variable length binary data.

RAML `type: file`

### Edm.DateTime

The DateTime type represents date and time with values ranging from 12:00:00 midnight, January 1,
1753 A.D. through 11:59:59 P.M, December 31, 9999 A.D.

RAML `type: datetime-only`

### Edm.Int32

The Int32 type represents a signed 32-bit integer value.

RAML `type: integer`

### Edm.Int64

The Int64 type represents a signed 64-bit integer value.

RAML `type: integer`

RAML `format: int64`

### Edm.Int16

The Int16 type represents a signed 16-bit integer value.

RAML `type: integer`

RAML `format: int16`

### Edm.Byte

The Byte type represents an unsigned 8-bit integer value.

RAML `type: integer`

RAML `format: int8`

### Edm.Decimal

The Decimal type represents numeric values with fixed precision and scale. You can specify the
required precision and scale by modifying these optional properties. This type can describe a
numeric value ranging from negative 10^255 + 1 to positive 10^255 -1.

RAML `type: number`

RAML `(odata.precision): 3`

RAML `(odata.scale): 3`

### Edm.Guid

The globally unique identifier (GUID) type represents a 16-byte (128-bit) number compliant with the
UUID standard (RFC 4122).

RAML `type: string`

RAML `(odata.type): guid`

### Edm.Time

The Time type represents the time of day with values ranging from 0:00:00.x to 23:59:59.y, where x
and y depend upon the precision.

RAML `type: time-only`

### Edm.DateTimeOffset

The DateTimeOffset type represents date and time as an offset in minutes from GMT, with values
ranging from 12:00:00 midnight, January 1, 1753 A.D. through 11:59:59 P.M, December 9999 A.D.

RAML `type: datetime`
