A language for describing JSON structures in API documentation.
JSONDL is intended for documenting APIs. It focusses on human readability so at this point there is no parser for JSONDL.
A resource can be said to consume a particular type C
and produce a result of type P
. A resource can thus be described as a function:
POST /api/users : User -> UserId
Say we want an object of type User
to look like this:
{
"user_id": 10,
"user_email": "john@example.com",
"user_name": "John Smith",
"user_age": 32
}
We can describe it (along with some obvious constrains) as:
User = {
user_id: UserId,
user_email: Email,
user_name: String,
user_age: UInt
}
UserId = UInt
Notice that the quotes are left off the keys and that on the right hand side of each colon is a type name. Also there are actually two type declarations here, User
and UserId
. In the case of UserId
we're just defining it to be an alias of UInt
.
JSONDL defines the following base types:
Boolean
- The literal JSONtrue
orfalse
. (In type union notation:Boolean = true | false
)
TODO
TODO
TODO
TODO