pub struct OpenRpc {
pub openrpc: String,
pub info: Info,
pub servers: Vec<Server>,
pub methods: Vec<RefOr<Method>>,
pub components: Option<Components>,
pub external_docs: Option<ExternalDocumentation>,
}
Expand description
Represents an OpenRPC document.
Fields§
§openrpc: String
The semantic version number of the OpenRPC Specification version that the OpenRPC document uses.
This field should be used by tooling specifications and clients to interpret the OpenRPC document.
info: Info
Provides metadata about the API.
This metadata may be used by tooling as required.
servers: Vec<Server>
An array of Server
objects, which provide connectivity information to a target server.
If the servers
property is not provided, or is an empty array, the default value would
be a Server
with a url
value of localhost
. This is taken care of by the
open-rpc
crate.
methods: Vec<RefOr<Method>>
The available methods for the API. While this field is required, it is legal to leave it empty.
components: Option<Components>
Holds various schemas for the specification.
external_docs: Option<ExternalDocumentation>
Contains additional documentation.
Implementations§
Source§impl OpenRpc
impl OpenRpc
Sourcepub fn get_schema(&self, reference: &str) -> Option<&Schema>
pub fn get_schema(&self, reference: &str) -> Option<&Schema>
Sourcepub fn get_content_descriptor(
&self,
reference: &str,
) -> Option<&ContentDescriptor>
pub fn get_content_descriptor( &self, reference: &str, ) -> Option<&ContentDescriptor>
Returns the ContentDescriptor
with the given path reference.
§Examples
let path = "#/components/errors/MY_ERROR";
let schema = openrpc.get_schema(path).unwrap();