Skip to content

Latest commit

 

History

History
37 lines (31 loc) · 1.21 KB

README.MD

File metadata and controls

37 lines (31 loc) · 1.21 KB

Actix Web OpenAPI

Version MIT/Apache-2.0


Usage

extern crate actix_web_openapi;

fn main() {
    match actix_web_openapi::from_path("./data/v3.0/petstore.yaml") {
        Ok(spec) => {
            let servers = spec.servers.unwrap();

            for server in servers.iter() {
                match server.to_client_request().finish() {
                    Ok(client) => {
                        assert_eq!(client.uri().scheme_str(), Some("http"));
                        assert_eq!(client.uri().host(), Some("petstore.swagger.io"));
                        assert_eq!(client.uri().port_u16(), None);
                        assert_eq!(client.uri().path(), "/v1");
                    },
                    Err(_err) => assert!(false),
                } 
            }
        },
        Err(_err) => assert!(false),
    }
}

License

This soltuion uses open source products and is constrained to the inherited license agreements.