Documentation
¶
Overview ¶
Package dsl is the list of osapi's DSLs: the behavior DSL, the chain rules, the endpoint DSL and the command DSL. Each DSL registers once, with what it shares with the others: the commands that teach and check it, its skill, its docs page, and, for a DSL whose definitions serve the API, its permissions and operations. The role rule, the SDK's permission constants and the UI's operation permissions read this list, and a test fails when a DSL lacks a part that the others have. Thus a change to what the DSLs share reaches each of them.
Index ¶
Constants ¶
const ( CommandList = "list" CommandGet = "get" CommandMethod = "method get" CommandSpec = "spec get" CommandValidate = "validate" CommandCreate = "create" CommandOpenAPI = "openapi get" )
The commands that every DSL has, under the command of its group. A DSL where one does not apply says why in Without.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type DSL ¶
type DSL struct {
// Name is the DSL, such as behavior.
Name string
// Command is the words of the command of its group, such as dsl
// endpoint.
Command []string
// Skill is the dev skill that teaches it, such as build-a-behavior.
Skill string
// Page is its page under docs/docs/sidebar/development/dsl, which its
// spec writes.
Page string
// Permissions are the permissions of each registered definition. Nil for
// a DSL whose definitions serve no API.
Permissions func() []Declared
// Operations are the served methods of each registered definition. Nil
// for a DSL whose definitions serve no API.
Operations func() []Operation
// Without are the shared commands that do not apply to the DSL, each
// with why.
Without map[string]string
}
DSL is one DSL and the parts that it shares with the others.
type Declared ¶
type Declared struct {
// Permission is the permission.
Permission types.Permission
// AdminOnly is true when the method is marked AdminOnly.
AdminOnly bool
// Named is true when the method names a permission that something else
// declares, as an endpoint method's .Permission does.
Named bool
// Where is the definition and its method, for an error.
Where string
}
Declared is a permission that a method of a definition needs.
type Operation ¶
type Operation struct {
ID string
Permission types.Permission
}
Operation is a method that the API serves: its operationId and the permission that it needs.