6 releases

Uses old Rust 2015

0.1.5 Apr 30, 2017
0.1.4 Apr 26, 2017

#2635 in Database interfaces

Download history 26/week @ 2023-12-18 44/week @ 2023-12-25 62/week @ 2024-01-01 91/week @ 2024-01-08 69/week @ 2024-01-15 17/week @ 2024-01-22 61/week @ 2024-01-29 98/week @ 2024-02-05 173/week @ 2024-02-12 84/week @ 2024-02-19 141/week @ 2024-02-26 61/week @ 2024-03-04 73/week @ 2024-03-11 132/week @ 2024-03-18 142/week @ 2024-03-25 195/week @ 2024-04-01

552 downloads per month
Used in service_policy_kit

MIT license

94KB
190 lines

open api Build Status

Rust crate for serializing and deserializing open api documents

Documentation

install

add the following to your Cargo.toml file

[dependencies]
openapi = "0.1"

usage

extern crate openapi;

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

Doug Tangren (softprops) 2017


lib.rs:

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.

Dependencies

~4–5.5MB
~120K SLoC