pub struct Spec {
pub spec: Spec,
}Expand description
OpenAPI specification wrapper that provides convenience methods for working with oas3::Spec
Fields§
§spec: SpecImplementations§
Source§impl Spec
impl Spec
Sourcepub async fn from_url(url: &Url) -> Result<Self, Error>
pub async fn from_url(url: &Url) -> Result<Self, Error>
Load and parse an OpenAPI specification from a URL
Sourcepub async fn from_file(path: &str) -> Result<Self, Error>
pub async fn from_file(path: &str) -> Result<Self, Error>
Load and parse an OpenAPI specification from a file
Sourcepub fn from_value(json_value: Value) -> Result<Self, Error>
pub fn from_value(json_value: Value) -> Result<Self, Error>
Parse an OpenAPI specification from a JSON value
Sourcepub fn to_tool_metadata(
&self,
tag_filter: Option<&[String]>,
method_filter: Option<&[Method]>,
) -> Result<Vec<ToolMetadata>, Error>
pub fn to_tool_metadata( &self, tag_filter: Option<&[String]>, method_filter: Option<&[Method]>, ) -> Result<Vec<ToolMetadata>, Error>
Convert all operations to MCP tool metadata
Sourcepub fn to_openapi_tools(
&self,
tag_filter: Option<&[String]>,
method_filter: Option<&[Method]>,
base_url: Option<Url>,
default_headers: Option<HeaderMap>,
) -> Result<Vec<Tool>, Error>
pub fn to_openapi_tools( &self, tag_filter: Option<&[String]>, method_filter: Option<&[Method]>, base_url: Option<Url>, default_headers: Option<HeaderMap>, ) -> Result<Vec<Tool>, Error>
Convert all operations to OpenApiTool instances with HTTP configuration
§Errors
Returns an error if any operations cannot be converted or OpenApiTool instances cannot be created
Sourcepub fn get_operation(
&self,
operation_id: &str,
) -> Option<(&Operation, String, String)>
pub fn get_operation( &self, operation_id: &str, ) -> Option<(&Operation, String, String)>
Get operation by operation ID
Sourcepub fn get_operation_ids(&self) -> Vec<String>
pub fn get_operation_ids(&self) -> Vec<String>
Get all operation IDs
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Spec
impl RefUnwindSafe for Spec
impl Send for Spec
impl Sync for Spec
impl Unpin for Spec
impl UnwindSafe for Spec
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more