Resource Classes (RCs) are the basic component of the API schema. They describe the behavior of a resource (identified by a URI)

They generally consist of:

See the “Properties” section below for more detail what you can put in a Resource Class.

RCs can have Generics. They can also be extended - see RC Inheritance.

Example

A simple one looks like this:

resource Account { 
	data Profile

	links { 
		change-password -> ChangePassword,
		change-email -> ChangeEmail, 
	} 

	PATCH @self% -> @self;
}

This describes a resource representing a user’s account. It has an associated data structure, with links to resources that allow the user to change their email or password, and a PATCH method that uses the Partial (Lax) Operator to accept incremental changes.

Type expressions within Resource Classes

When used for a method output or whatever, raw data types will be formatted as-is.

Resource classes can be used as types, too. When used as an input, this will refer to their base data type; as an output, it will be rendered according to Resource Serialization

Metaclasses

Within Links and Methods, there are a few “special” resource classes available, called metaclasses. These all begin with the @ sigil and are described below: