Crate openapi [] [src]

Openapi provides structures and support for serializing and deserializing openapi specifications

Examples

Typical use deserialing an existing to a persisted spec to rust form of visa versa

The hyper client should be configured with tls.

extern crate openapi;

fn main() {
  match openapi::from_path("path/to/openapi.yaml") {
    Ok(spec) => println!("spec: {:?}", spec),
    Err(err) => println!("error: {}", err)
  }
}

Errors

Operations typically result in a openapi::Result Type which is an alias for Rust's built-in Result with the Err Type fixed to the openapi::errors::Error enum type. These are provided using error_chain crate so their shape and behavior should be consistent and familiar to existing error_chain users.

Reexports

pub use errors::Result;
pub use errors::ResultExt;

Modules

errors

errors that openapi functions may return

Structs

ExternalDoc
Info
Operation
Operations
Parameter
Response
Schema

A JSON schema definition describing the shape and properties of an object.

Security
Spec

top level document

Tag

Functions

from_path

deserialize an open api spec from a path

from_reader

deserialize an open api spec from type which implements Read

to_json

serialize to a json string

to_yaml

serialize to a yaml string