#[non_exhaustive]pub struct ElicitationSchema {
pub type_: ElicitationSchemaType,
pub title: Option<String>,
pub properties: BTreeMap<String, ElicitationPropertySchema>,
pub required: Option<Vec<String>>,
pub description: Option<String>,
pub meta: Option<Map<String, Value>>,
}Expand description
Type-safe elicitation schema for requesting structured user input.
This represents a JSON Schema object with primitive-typed properties, as required by the elicitation specification.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.type_: ElicitationSchemaTypeType discriminator. Always "object".
title: Option<String>Optional title for the schema.
properties: BTreeMap<String, ElicitationPropertySchema>Property definitions (must be primitive types).
required: Option<Vec<String>>List of required property names.
description: Option<String>Optional description of what this schema represents.
meta: Option<Map<String, Value>>The _meta property is reserved by ACP to allow clients and agents to attach additional metadata to their interactions. Implementations MUST NOT make assumptions about values at these keys.
See protocol docs: Extensibility
Implementations§
Source§impl ElicitationSchema
impl ElicitationSchema
Sourcepub fn new() -> ElicitationSchema
pub fn new() -> ElicitationSchema
Create a new empty elicitation schema.
Sourcepub fn title(self, title: impl IntoOption<String>) -> ElicitationSchema
pub fn title(self, title: impl IntoOption<String>) -> ElicitationSchema
Optional title for the schema.
Sourcepub fn description(
self,
description: impl IntoOption<String>,
) -> ElicitationSchema
pub fn description( self, description: impl IntoOption<String>, ) -> ElicitationSchema
Optional description of what this schema represents.
Sourcepub fn meta(
self,
meta: impl IntoOption<Map<String, Value>>,
) -> ElicitationSchema
pub fn meta( self, meta: impl IntoOption<Map<String, Value>>, ) -> ElicitationSchema
The _meta property is reserved by ACP to allow clients and agents to attach additional metadata to their interactions. Implementations MUST NOT make assumptions about values at these keys.
See protocol docs: Extensibility
Sourcepub fn property<S>(
self,
name: impl Into<String>,
schema: S,
required: bool,
) -> ElicitationSchemawhere
S: Into<ElicitationPropertySchema>,
pub fn property<S>(
self,
name: impl Into<String>,
schema: S,
required: bool,
) -> ElicitationSchemawhere
S: Into<ElicitationPropertySchema>,
Add a property to the schema.
Sourcepub fn string(
self,
name: impl Into<String>,
required: bool,
) -> ElicitationSchema
pub fn string( self, name: impl Into<String>, required: bool, ) -> ElicitationSchema
Add a string property.
Sourcepub fn email(self, name: impl Into<String>, required: bool) -> ElicitationSchema
pub fn email(self, name: impl Into<String>, required: bool) -> ElicitationSchema
Add an email property.
Sourcepub fn uri(self, name: impl Into<String>, required: bool) -> ElicitationSchema
pub fn uri(self, name: impl Into<String>, required: bool) -> ElicitationSchema
Add a URI property.
Sourcepub fn date(self, name: impl Into<String>, required: bool) -> ElicitationSchema
pub fn date(self, name: impl Into<String>, required: bool) -> ElicitationSchema
Add a date property.
Sourcepub fn date_time(
self,
name: impl Into<String>,
required: bool,
) -> ElicitationSchema
pub fn date_time( self, name: impl Into<String>, required: bool, ) -> ElicitationSchema
Add a date-time property.
Sourcepub fn number(
self,
name: impl Into<String>,
min: f64,
max: f64,
required: bool,
) -> ElicitationSchema
pub fn number( self, name: impl Into<String>, min: f64, max: f64, required: bool, ) -> ElicitationSchema
Add a number property with range.
Trait Implementations§
Source§impl Clone for ElicitationSchema
impl Clone for ElicitationSchema
Source§fn clone(&self) -> ElicitationSchema
fn clone(&self) -> ElicitationSchema
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ElicitationSchema
impl Debug for ElicitationSchema
Source§impl Default for ElicitationSchema
impl Default for ElicitationSchema
Source§fn default() -> ElicitationSchema
fn default() -> ElicitationSchema
Source§impl<'de> Deserialize<'de> for ElicitationSchema
impl<'de> Deserialize<'de> for ElicitationSchema
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<ElicitationSchema, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<ElicitationSchema, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl IntoV2 for ElicitationSchema
Available on crate feature unstable_elicitation only.
impl IntoV2 for ElicitationSchema
unstable_elicitation only.Source§type Output = ElicitationSchema
type Output = ElicitationSchema
Source§fn into_v2(
self,
) -> Result<<ElicitationSchema as IntoV2>::Output, ProtocolConversionError>
fn into_v2( self, ) -> Result<<ElicitationSchema as IntoV2>::Output, ProtocolConversionError>
Source§impl JsonSchema for ElicitationSchema
impl JsonSchema for ElicitationSchema
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read moreSource§impl PartialEq for ElicitationSchema
impl PartialEq for ElicitationSchema
Source§fn eq(&self, other: &ElicitationSchema) -> bool
fn eq(&self, other: &ElicitationSchema) -> bool
self and other values to be equal, and is used by ==.