dsl

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 27, 2026 License: MIT Imports: 4 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

View Source
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

func Commands

func Commands() []string

Commands are the shared commands, in the order that a page lists them.

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.

func All

func All() []DSL

All are the registered DSLs, by name.

func Register

func Register(
	d DSL,
) DSL

Register adds d to the DSLs. Each DSL's package calls it in its init.

func (DSL) ServesAPI

func (d DSL) ServesAPI() bool

ServesAPI reports whether the DSL's definitions serve the API.

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL