basic/
basic.rs

1use swagger_ui::{Assets, Config, Spec, DefaultModelRendering, DocExpansion, Filter, swagger_spec_file};
2
3fn main() {
4    println!("swagger-ui bundles files:");
5    // Use Assets::iter() to get iterator of all filenames
6    for file in Assets::iter() {
7        let filename = file.as_ref();
8        println!("\t{}", filename);
9        // `Assets::get(filename)` returns file content
10    };
11
12    // Load openapi spec (compile-time)
13    let _spec: Spec = swagger_spec_file!("./openapi.json");
14
15    // swagger-ui configuration struct
16    let _config: Config = Config {
17        url: "".to_string(),
18        urls: vec![],
19        deep_linking: false,
20        display_operation_id: false,
21        default_models_expand_depth: 0,
22        default_model_expand_depth: 0,
23        default_model_rendering: DefaultModelRendering::Example,
24        display_request_duration: false,
25        doc_expansion: DocExpansion::List,
26        filter: Filter::Bool(false),
27        max_displayed_tags: 0,
28        show_extensions: false,
29        show_common_extensions: false
30    };
31}