A11 (C++ runtime)
Native C++ implementation of the A11 action and streaming runtime
Loading...
Searching...
No Matches
a11::actions::ActionSchema Struct Reference

The full typed interface of an action. More...

#include <cpp/a11/actions/schema.h>

Public Member Functions

absl::Status Validate () const
 Validates the schema and all of its ports and headers.
 
absl::Status MapOutputToJson (std::string output_name, std::string field_name={})
 Maps an output port onto a JSON result field.
 

Public Attributes

std::string name
 Action name.
 
std::string description
 Human-readable description.
 
absl::flat_hash_map< std::string, ActionPortSchemainputs
 Input ports.
 
absl::flat_hash_map< std::string, ActionPortSchemaoutputs
 Output ports.
 
absl::flat_hash_map< std::string, ActionHeaderSchemaheaders
 Headers.
 
absl::flat_hash_map< std::string, std::string > output_to_json_field
 Maps output port names to JSON result fields.
 

Static Public Attributes

static constexpr std::string_view kWholeJson = "$"
 Whole-JSON target.
 

Friends

bool operator== (const ActionSchema &, const ActionSchema &)=default
 

Detailed Description

The full typed interface of an action.

Combines the action's name and description with its inputs, outputs and headers schemas. output_to_json_field optionally maps output ports onto fields of a single JSON result document (use kWholeJson to map an output to the whole document).

Member Function Documentation

◆ MapOutputToJson()

absl::Status a11::actions::ActionSchema::MapOutputToJson ( std::string  output_name,
std::string  field_name = {} 
)

Maps an output port onto a JSON result field.

Parameters
output_nameOutput port to map.
field_nameTarget field; empty maps to a field named like the port.

◆ Validate()

absl::Status a11::actions::ActionSchema::Validate ( ) const

Validates the schema and all of its ports and headers.

Friends And Related Symbol Documentation

◆ operator==

bool operator== ( const ActionSchema ,
const ActionSchema  
)
friend

Member Data Documentation

◆ description

std::string a11::actions::ActionSchema::description

Human-readable description.

◆ headers

absl::flat_hash_map<std::string, ActionHeaderSchema> a11::actions::ActionSchema::headers

Headers.

◆ inputs

absl::flat_hash_map<std::string, ActionPortSchema> a11::actions::ActionSchema::inputs

Input ports.

◆ kWholeJson

constexpr std::string_view a11::actions::ActionSchema::kWholeJson = "$"
staticconstexpr

Whole-JSON target.

◆ name

std::string a11::actions::ActionSchema::name

Action name.

◆ output_to_json_field

absl::flat_hash_map<std::string, std::string> a11::actions::ActionSchema::output_to_json_field

Maps output port names to JSON result fields.

◆ outputs

absl::flat_hash_map<std::string, ActionPortSchema> a11::actions::ActionSchema::outputs

Output ports.


The documentation for this struct was generated from the following files: