pub trait OpenapiType {
// Required method
fn visit_type<V: Visitor>(visitor: &mut V);
// Provided method
fn schema() -> OpenapiSchema { ... }
}
Expand description
This trait needs to be implemented by every type that is being used in the OpenAPI Spec. It gives access to the OpenapiSchema of this type. It is provided for primitive types, String and the like. For use on your own types, there is a derive macro:
#[derive(OpenapiType)]
struct MyResponse {
message: String
}
Required Methods§
fn visit_type<V: Visitor>(visitor: &mut V)
Provided Methods§
fn schema() -> OpenapiSchema
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.