comline/tests/idl/simple.ids

44 lines
977 B
Plaintext

// Simple Schema
namespace tests.idl.simple
import std::validators::StringBounds
const POWER: u8 = 1
const DEFAULT_NAME: str = f"flower power: {POWER}"
settings Test {
forbid_indexing=True
forbid_optional_indexing=True
}
enum EncryptionMode {
None
Encrypt
}
/// A message that can be sent through the mail protocol
struct Message {
1# name: str = DEFAULT_NAME
2# encryption_mode: EncryptionMode = default
@validators=[StringBounds(min_chars=3 max_chars=12)]
2# optional recipient: str = "bee"
}
/// Throw when sending a message to a missing recipient
error RecipientNotFoundError {
message = "Recipient with name {self.recipient} not found"
@validators=[StringBounds(min_chars=8 max_chars=16)]
1# recipient: str
}
/// Mail API for receiving and sending emails
@provider=Any
protocol Mail {
@timeout_ms=1000
1# function send_message(message: Message) -> str
! RecipientNotFoundError(function.message.recipient)
}