Skip to content

Commit

Permalink
Chore improve utoipa api (#46)
Browse files Browse the repository at this point in the history
* Add internal builder macro
* Document OpenApi, License, Contanct and Info and their respective builder types.
* Implement builders for OpenApi, Info, License and Contact structs.
* Fix related tests and doc tests.
  • Loading branch information
juhaku authored Mar 21, 2022
1 parent fd2d7c8 commit e14717e
Show file tree
Hide file tree
Showing 19 changed files with 851 additions and 595 deletions.
26 changes: 14 additions & 12 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -195,18 +195,20 @@ pub use utoipa_gen::*;
/// impl utoipa::OpenApi for OpenApiDoc {
/// fn openapi() -> utoipa::openapi::OpenApi {
/// use utoipa::{Component, Path};
/// utoipa::openapi::OpenApi::new(
/// utoipa::openapi::Info::new("application name", "version")
/// .with_description("application description")
/// .with_license(utoipa::openapi::License::new("MIT"))
/// .with_contact(
/// utoipa::openapi::Contact::new()
/// .with_name("author name")
/// .with_email("author email"),
/// ),
/// utoipa::openapi::path::Paths::new(),
/// )
/// .with_components(utoipa::openapi::Components::new())
/// utoipa::openapi::OpenApiBuilder::new()
/// .info(utoipa::openapi::InfoBuilder::new()
/// .title("application name")
/// .version("version")
/// .description(Some("application description"))
/// .license(Some(utoipa::openapi::License::new("MIT")))
/// .contact(
/// Some(utoipa::openapi::ContactBuilder::new()
/// .name(Some("author name"))
/// .email(Some("author email")).build()),
/// ).build())
/// .paths(utoipa::openapi::path::Paths::new())
/// .components(Some(utoipa::openapi::Components::new()))
/// .build()
/// }
/// }
/// ```
Expand Down
Loading

0 comments on commit e14717e

Please sign in to comment.