#openapi #v3


This crate provides data structures that represent the OpenAPI v3.0.x specification easily deserializable with serde

22 releases (4 stable)

2.0.0-rc.1 Oct 21, 2023
1.0.3 Aug 28, 2023
1.0.2 Dec 9, 2022
1.0.1 Jan 20, 2022
0.1.3 Mar 5, 2019

#45 in Parser implementations

Download history 14890/week @ 2023-08-08 13162/week @ 2023-08-15 17658/week @ 2023-08-22 17227/week @ 2023-08-29 17652/week @ 2023-09-05 19781/week @ 2023-09-12 16522/week @ 2023-09-19 16301/week @ 2023-09-26 18520/week @ 2023-10-03 19242/week @ 2023-10-10 17510/week @ 2023-10-17 18442/week @ 2023-10-24 18431/week @ 2023-10-31 16864/week @ 2023-11-07 18624/week @ 2023-11-14 12756/week @ 2023-11-21

70,985 downloads per month
Used in 44 crates (29 directly)



OpenAPI v3 example workflow

This crate provides data structures that represent the OpenAPI v3.0.x specification. Note this does not cover OpenAPI v3.1 which was an incompatible change.


use serde_json;
use openapiv3::OpenAPI;

fn main() {
    let data = include_str!("openapi.json");
    let openapi: OpenAPI = serde_json::from_str(data).expect("Could not deserialize input");
    println!("{:?}", openapi);


  • Provide a deserialization for the specification that maps cleanly to Rust enums etc.

Non Goals

  • Deserialization and subsequent re-serialization are 100% the same.
    • Some defaults show-up when serializing that may not have existed in the input.


Schemas without a type will end up as any data type as per the specification and can have any parameters of any schema type. Some Open API documents don't include the type parameter it would be nice to try to derive the type but the crate as of right now meets my needs.

Similar Crates


This crate is licensed under either of

Apache License, Version 2.0, (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)


Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this crate by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.


~47K SLoC