Skip to content

Overview

Data API block allows developers to create REST, GraphQL, gRPC, and OData APIs without writing any code. Developers define the APIs required through YAML for 90% of the cases. If there are specific cases where more control is needed, they can extend the service with few lines of JavaScript or WASM.

Data API block does not generate any code. It creates required API endpoints at run-time based on the YAML files and configuration. Read more about our views on Model-Driven Development (MDD). This makes it faster to develop and easier to deploy.

Key Concepts

Datastore

Datastore is a logical grouping of enums, embeddables and entities. Every datastore is tied to a database.

Enums

Enums allow developers to define list of values. Entities can have one more fields with data type as enum.

1
# enum for week days
2
enums:
3
- name: weekdays
4
values:
5
- value: Sunday
6
- value: Monday
7
- value: Tuesday
8
- value: Wednesday
9
- value: Thursday
10
- value: Friday
11
- value: Saturday

Embeddables

Embeddables are like entities, but do not have real tables or collection. They work like entities for validations and computed fields but cannot exist without entities. They are useful to create validated nested structures as JSON objects in relational table or as nested document in NoSQL collections.

1
embeddables:
2
- name: pincode
3
fields:
4
- name: pincode
5
type: string
6
validations:
7
- type: required

Traits

Traits are way to group together common features that entities should have, like common fields with validations. Developers apply traits to entities with the inherits definition.

kisai-standard.yaml
1
namespace: kisai
2
traits:
3
- name: id
4
fields:
5
- name: id
6
type: ulid
7
defaultvalue: ulid()
8
validations:
9
- type: required
10
- type: unique
11
message: id field needs to be unique
12
- type: final
13
message: id field cannot be updated

Types

Data types are the categories of data values that can be stored, processed, and retrieved by a programming language. Common data types include numbers (integers, floats, complex), characters (single characters, strings), booleans (true/false), dates, times, and null/undefined values.

Having a universal type system allows for each integration between various services across technology stacks, programming language, and system boundaries.

Entities

Entities are foundational blocks of building datastores and APIs. Each entity is mapped to a table in a relation database and to a collection in a Document database.

ticket.yaml
1
entities:
2
- name: ticket
3
inherits: kisai.id
4
fields:
5
- name: name
6
type: string
7
validations:
8
- type: required # validation marking the field as mandatory
9
message: name is a required field # error message to send when validation fails
10
- name: description
11
type: string
12
- name: duedate
13
type: date
14
- name: priority
15
type: priority
16
- name: state
17
type: string
18
stateflow: ticketflow

Stateflows

In kis.ai, we introduce a powerful feature called stateflows, which function similarly to state machines. Stateflows are assigned to fields within an application, defining the finite set of values a field can hold and the specific order in which these values can be transitioned.

1
stateflows:
2
- name: ticketflow
3
initial: Open
4
states:
5
- name: Open
6
on:
7
START:
8
target: accepted
9
- name: In Progress
10
on:
11
RESOLVE:
12
target: Resolved
13
- name: Resolved
14
on:
15
CLOSE:
16
target: Closed
17
REOPEN:
18
target: Open
19
- name: Closed
20
type: final

Query Hashes

Remote Entities