pub struct EndpointMeta {
pub name: String,
pub path: String,
pub protocol: Protocol,
pub description: Option<String>,
pub method: Option<String>,
pub request_schema: Option<Value>,
pub response_schema: Option<Value>,
pub tags: Vec<String>,
}Expand description
Fully-qualified description of an endpoint exposed by the application.
An EndpointMeta carries everything required to generate documentation
for a single endpoint: its human-readable name, network location, protocol
and optional request/response JSON schemas.
Schemas are stored as raw serde_json::Value instances to avoid a hard
dependency on a specific schema-generation crate in the public API.
Fields§
§name: StringDisplay name of the endpoint, used as a title in generated docs.
path: StringURL path (for HTTP/WebSocket) or topic string (for MQTT).
protocol: ProtocolTransport protocol used by this endpoint.
description: Option<String>Optional long-form, human-readable description.
method: Option<String>HTTP verb (GET, POST, …). None for WebSocket and MQTT endpoints.
request_schema: Option<Value>JSON Schema describing the expected request payload, when applicable.
response_schema: Option<Value>JSON Schema describing the response payload, when applicable.
Tags used to group the endpoint in the documentation UI.
Implementations§
Source§impl EndpointMeta
impl EndpointMeta
Sourcepub fn new(
name: impl Into<String>,
path: impl Into<String>,
protocol: Protocol,
) -> Self
pub fn new( name: impl Into<String>, path: impl Into<String>, protocol: Protocol, ) -> Self
Create a new EndpointMeta with only the mandatory fields populated.
Optional fields (description, method, request_schema,
response_schema) are initialised to None and can be filled in
afterwards by mutating the returned value.
§Examples
use lucy_types::endpoint::{EndpointMeta, Protocol};
let meta = EndpointMeta::new("health", "/health", Protocol::Http);
assert_eq!(meta.name, "health");
assert_eq!(meta.path, "/health");
assert_eq!(meta.protocol, Protocol::Http);Trait Implementations§
Source§impl Clone for EndpointMeta
impl Clone for EndpointMeta
Source§fn clone(&self) -> EndpointMeta
fn clone(&self) -> EndpointMeta
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more