Skip to content

baobab.specification #

fn from_openapi #

fn from_openapi(spec_raw OpenAPI) !ActorSpecification

Converts OpenAPI to ActorSpecification

fn from_openrpc #

fn from_openrpc(spec OpenRPC) !ActorSpecification

Converts OpenRPC to ActorSpecification

fn method_to_openrpc_method #

fn method_to_openrpc_method(method ActorMethod) openrpc.Method

enum ActorInterface #

enum ActorInterface {
	openrpc
	openapi
	webui
	command
	http
}

enum MethodCategory #

enum MethodCategory {
	base_object_new
	base_object_get
	base_object_set
	base_object_delete
	base_object_list
	other
}

struct ActorMethod #

struct ActorMethod {
pub:
	name        string @[omitempty]
	description string @[omitempty]
	summary     string
	example     ExamplePairing
	parameters  []ContentDescriptor
	result      ContentDescriptor
	errors      []ErrorSpec
	category    MethodCategory
}

struct ActorSpecification #

struct ActorSpecification {
pub mut:
	version     string = '1.0.0'
	openapi     ?openapi.OpenAPI
	openrpc     ?openrpc.OpenRPC
	name        string           @[omitempty]
	description string           @[omitempty]
	structure   Struct           @[omitempty]
	interfaces  []ActorInterface @[omitempty]
	methods     []ActorMethod    @[omitempty]
	objects     []BaseObject     @[omitempty]
}

fn (ActorSpecification) method_type #

fn (s ActorSpecification) method_type(method ActorMethod) MethodCategory

method category returns what category a method falls under

fn (ActorSpecification) to_openapi #

fn (s ActorSpecification) to_openapi() OpenAPI

Converts ActorSpecification to OpenAPI

fn (ActorSpecification) to_openrpc #

fn (specification ActorSpecification) to_openrpc() OpenRPC

// Build the Actor struct return ActorSpecification{ // name: actor_name // description: actor_description // methods: methods // objects: objects } }

fn (ActorSpecification) validate #

fn (s ActorSpecification) validate() ActorSpecification

struct BaseObject #

struct BaseObject {
pub mut:
	schema        Schema
	new_method    ?ActorMethod
	get_method    ?ActorMethod
	set_method    ?ActorMethod
	delete_method ?ActorMethod
	list_method   ?ActorMethod
	filter_method ?ActorMethod
	other_methods []ActorMethod
}

fn (BaseObject) name #

fn (o BaseObject) name() string