---
# System prepended metadata

title: Shared Horse structure on ZED and Racing API

---

# Shared Horse structure on ZED and Racing API

There's a new data type as `Horse` on ZED LIB that is shared across Racing API and Zed API. Ideally this type of work would be done with something like Protobufs but due to the urgency we opted to make it a transient type on ZED LIB. This type holds some lending information as well as a `class` (for Racing, and ZED API sometimes), and an `owner`. What we wanted to achieve with this is have a common struct for certain type of information being sent through inter-service-communication. Using gRPC and PFs moving forward should be the way to go but this can set a good example of shareable contracts for now.

It works very simply, ZED API and Racing API inherit the struct (aliased as `LibHorse` in the code to avoid redundancy) and converts data to it for better and more reliable manipulation.

```elixir
# From ZED API
data = db_data()
struct(LibHorse, data)

# From Racing API
data = ZEDAPI.get_horse(horse)
struct(LibHorse, data)
# ... manipulate
```

This way they both know what type of data always to expect even if the response changes.