Data model inheritance - from little things, big things grow

With data model inheritance in Pokko you can build out your data model by layering structure on structure.

Simply put - data model inheritance allows you to build complex models from smaller, simpler building blocks.

What it allows you to do is identify commonalities shared between your data models, extrapolate them and configure them in one place to be shared rather than duplicating the configuration.

The simplest way to conceptualise this is a website.

Every page on a website has certain features, regardless of what time of page it is. At the very least there is metadata - i.e., the page title and description.

You might have a news section, regular content and maybe some resources. That's 3 more page types (data models), but they all still need metadata.

Instead of adding a page title and description field to each of those data models, you could create a Metadata data model that those page types inherit from. This carries over to your GraphQL API data model via interfaces, so you can have a shared query for all those page types.

Pokko takes this one step further and allows for data inheritance.

Base values are a Pokko concept that are akin to default values. At the model level, you can specify the base (default) values for each field. When querying entries of that model type the base value from the model will be returned if no value on the entry has been specified.

Base values obey inheritance as well. Using the above example: you have a News article model inheriting from the Metadata model. On the Metadata model, there is a base value entered in the page title field, no base value for that field is specified on the News article and no value is specified on your News article entry. The value from Metadata will be returned when querying your entry.