#openapi #swagger #api #validation #oas3

oas3

Structures and tools to parse, navigate and validate OpenAPI v3 specifications

3 unstable releases

0.2.1 Oct 12, 2020
0.2.0 Oct 12, 2020
0.0.1 Aug 9, 2019

#220 in Testing

Download history 8/week @ 2021-07-03 4/week @ 2021-07-10 4/week @ 2021-07-17 15/week @ 2021-07-24 9/week @ 2021-07-31 15/week @ 2021-08-07 4/week @ 2021-08-14 13/week @ 2021-08-21 21/week @ 2021-08-28 3/week @ 2021-09-04 12/week @ 2021-09-11 5/week @ 2021-09-18 3/week @ 2021-09-25 10/week @ 2021-10-02 9/week @ 2021-10-09

69 downloads per month

MIT license

140KB
3K SLoC

OAS3

Structures and tools to parse, navigate and validate OpenAPI v3 Spec files.

Based on v3 parts of openapi crate by softprops.

Additional features:

  • Validation constructors
  • Example request/response validation
  • Live API conformance testing

Install

add the following to your Cargo.toml file

[dependencies]
oas3 = "0.1"

Usage

extern crate oas3;

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

lib.rs:

Structures and tools to parse, navigate and validate OpenAPI v3 specifications.

Example

match oas3::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.

Dependencies

~8–13MB
~284K SLoC