Skip to content

Commit

Permalink
Fix docs (#1138)
Browse files Browse the repository at this point in the history
  • Loading branch information
juhaku authored Oct 15, 2024
1 parent eaaa4c7 commit ab0693d
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 31 deletions.
10 changes: 5 additions & 5 deletions utoipa-gen/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1237,8 +1237,8 @@ pub fn derive_to_schema(input: TokenStream) -> TokenStream {
/// ```text
/// responses(
/// (status = 200, content(
/// ("application/vnd.user.v1+json" = User, example = json!(User {id: "id".to_string()})),
/// ("application/vnd.user.v2+json" = User2, example = json!(User2 {id: 2}))
/// (User = "application/vnd.user.v1+json", example = json!(User {id: "id".to_string()})),
/// (User2 = "application/vnd.user.v2+json", example = json!(User2 {id: 2}))
/// )
/// )
/// )
Expand Down Expand Up @@ -1417,9 +1417,9 @@ pub fn derive_to_schema(input: TokenStream) -> TokenStream {
/// # Security Requirement Attributes
///
/// * `name` Define the name for security requirement. This must match to name of existing
/// [`SecuritySchema`][security_schema].
/// [`SecurityScheme`][security_scheme].
/// * `scopes = [...]` Define the list of scopes needed. These must be scopes defined already in
/// existing [`SecuritySchema`][security_schema].
/// existing [`SecurityScheme`][security_scheme].
///
/// **Security Requirement supported formats:**
///
Expand Down Expand Up @@ -1828,7 +1828,7 @@ pub fn derive_to_schema(input: TokenStream) -> TokenStream {
/// [to_schema]: trait.ToSchema.html
/// [openapi]: derive.OpenApi.html
/// [security]: openapi/security/struct.SecurityRequirement.html
/// [security_schema]: openapi/security/enum.SecurityScheme.html
/// [security_scheme]: openapi/security/enum.SecurityScheme.html
/// [primitive]: https://doc.rust-lang.org/std/primitive/index.html
/// [into_params]: trait.IntoParams.html
/// [style]: openapi/path/enum.ParameterStyle.html
Expand Down
2 changes: 1 addition & 1 deletion utoipa-gen/tests/modify_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use utoipa::{
mod common;

#[test]
fn modify_openapi_add_security_schema() {
fn modify_openapi_add_security_scheme() {
#[derive(Default, OpenApi)]
#[openapi(modifiers(&SecurityAddon))]
struct ApiDoc;
Expand Down
4 changes: 2 additions & 2 deletions utoipa/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -973,11 +973,11 @@ pub trait Path {
/// See more about [`OpenApi`][derive] derive at [derive documentation][derive].
///
/// [derive]: derive.OpenApi.html
/// [security_schema]: openapi/security/enum.SecuritySchema.html
/// [security_scheme]: openapi/security/enum.SecurityScheme.html
///
/// # Examples
///
/// Add custom JWT [`SecuritySchema`][security_schema] to [`OpenApi`][`openapi::OpenApi`].
/// Add custom JWT [`SecurityScheme`][security_scheme] to [`OpenApi`][`openapi::OpenApi`].
/// ```rust
/// # use utoipa::{OpenApi, Modify};
/// # use utoipa::openapi::security::{SecurityScheme, HttpBuilder, HttpAuthScheme};
Expand Down
8 changes: 4 additions & 4 deletions utoipa/src/openapi/schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,10 @@ impl Components {
pub fn add_security_scheme<N: Into<String>, S: Into<SecurityScheme>>(
&mut self,
name: N,
security_schema: S,
security_scheme: S,
) {
self.security_schemes
.insert(name.into(), security_schema.into());
.insert(name.into(), security_scheme.into());
}

/// Add iterator of [`SecurityScheme`]s to [`Components`].
Expand Down Expand Up @@ -251,10 +251,10 @@ impl ComponentsBuilder {
pub fn security_scheme<N: Into<String>, S: Into<SecurityScheme>>(
mut self,
name: N,
security_schema: S,
security_scheme: S,
) -> Self {
self.security_schemes
.insert(name.into(), security_schema.into());
.insert(name.into(), security_scheme.into());

self
}
Expand Down
38 changes: 19 additions & 19 deletions utoipa/src/openapi/security.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1042,7 +1042,7 @@ mod tests {
}

test_fn! {
security_schema_correct_http_bearer_json:
security_scheme_correct_http_bearer_json:
SecurityScheme::Http(
HttpBuilder::new().scheme(HttpAuthScheme::Bearer).bearer_format("JWT").build()
);
Expand All @@ -1054,7 +1054,7 @@ mod tests {
}

test_fn! {
security_schema_correct_basic_auth:
security_scheme_correct_basic_auth:
SecurityScheme::Http(Http::new(HttpAuthScheme::Basic));
r###"{
"type": "http",
Expand All @@ -1063,7 +1063,7 @@ mod tests {
}

test_fn! {
security_schema_correct_digest_auth:
security_scheme_correct_digest_auth:
SecurityScheme::Http(Http::new(HttpAuthScheme::Digest));
r###"{
"type": "http",
Expand All @@ -1072,7 +1072,7 @@ mod tests {
}

test_fn! {
security_schema_correct_hoba_auth:
security_scheme_correct_hoba_auth:
SecurityScheme::Http(Http::new(HttpAuthScheme::Hoba));
r###"{
"type": "http",
Expand All @@ -1081,7 +1081,7 @@ mod tests {
}

test_fn! {
security_schema_correct_mutual_auth:
security_scheme_correct_mutual_auth:
SecurityScheme::Http(Http::new(HttpAuthScheme::Mutual));
r###"{
"type": "http",
Expand All @@ -1090,7 +1090,7 @@ mod tests {
}

test_fn! {
security_schema_correct_negotiate_auth:
security_scheme_correct_negotiate_auth:
SecurityScheme::Http(Http::new(HttpAuthScheme::Negotiate));
r###"{
"type": "http",
Expand All @@ -1099,7 +1099,7 @@ mod tests {
}

test_fn! {
security_schema_correct_oauth_auth:
security_scheme_correct_oauth_auth:
SecurityScheme::Http(Http::new(HttpAuthScheme::OAuth));
r###"{
"type": "http",
Expand All @@ -1108,7 +1108,7 @@ mod tests {
}

test_fn! {
security_schema_correct_scram_sha1_auth:
security_scheme_correct_scram_sha1_auth:
SecurityScheme::Http(Http::new(HttpAuthScheme::ScramSha1));
r###"{
"type": "http",
Expand All @@ -1117,7 +1117,7 @@ mod tests {
}

test_fn! {
security_schema_correct_scram_sha256_auth:
security_scheme_correct_scram_sha256_auth:
SecurityScheme::Http(Http::new(HttpAuthScheme::ScramSha256));
r###"{
"type": "http",
Expand All @@ -1126,7 +1126,7 @@ mod tests {
}

test_fn! {
security_schema_correct_api_key_cookie_auth:
security_scheme_correct_api_key_cookie_auth:
SecurityScheme::ApiKey(ApiKey::Cookie(ApiKeyValue::new(String::from("api_key"))));
r###"{
"type": "apiKey",
Expand All @@ -1136,7 +1136,7 @@ mod tests {
}

test_fn! {
security_schema_correct_api_key_header_auth:
security_scheme_correct_api_key_header_auth:
SecurityScheme::ApiKey(ApiKey::Header(ApiKeyValue::new("api_key")));
r###"{
"type": "apiKey",
Expand All @@ -1146,7 +1146,7 @@ mod tests {
}

test_fn! {
security_schema_correct_api_key_query_auth:
security_scheme_correct_api_key_query_auth:
SecurityScheme::ApiKey(ApiKey::Query(ApiKeyValue::new(String::from("api_key"))));
r###"{
"type": "apiKey",
Expand All @@ -1156,7 +1156,7 @@ mod tests {
}

test_fn! {
security_schema_correct_open_id_connect_auth:
security_scheme_correct_open_id_connect_auth:
SecurityScheme::OpenIdConnect(OpenIdConnect::new("https://localhost/openid"));
r###"{
"type": "openIdConnect",
Expand All @@ -1165,7 +1165,7 @@ mod tests {
}

test_fn! {
security_schema_correct_oauth2_implicit:
security_scheme_correct_oauth2_implicit:
SecurityScheme::OAuth2(
OAuth2::with_description([Flow::Implicit(
Implicit::new(
Expand Down Expand Up @@ -1193,7 +1193,7 @@ mod tests {
}

test_fn! {
security_schema_correct_oauth2_password:
security_scheme_correct_oauth2_password:
SecurityScheme::OAuth2(
OAuth2::with_description([Flow::Password(
Password::with_refresh_url(
Expand Down Expand Up @@ -1223,7 +1223,7 @@ mod tests {
}

test_fn! {
security_schema_correct_oauth2_client_credentials:
security_scheme_correct_oauth2_client_credentials:
SecurityScheme::OAuth2(
OAuth2::new([Flow::ClientCredentials(
ClientCredentials::with_refresh_url(
Expand Down Expand Up @@ -1252,7 +1252,7 @@ mod tests {
}

test_fn! {
security_schema_correct_oauth2_authorization_code:
security_scheme_correct_oauth2_authorization_code:
SecurityScheme::OAuth2(
OAuth2::new([Flow::AuthorizationCode(
AuthorizationCode::with_refresh_url(
Expand Down Expand Up @@ -1283,7 +1283,7 @@ mod tests {
}

test_fn! {
security_schema_correct_oauth2_authorization_code_no_scopes:
security_scheme_correct_oauth2_authorization_code_no_scopes:
SecurityScheme::OAuth2(
OAuth2::new([Flow::AuthorizationCode(
AuthorizationCode::with_refresh_url(
Expand All @@ -1308,7 +1308,7 @@ mod tests {
}

test_fn! {
security_schema_correct_mutual_tls:
security_scheme_correct_mutual_tls:
SecurityScheme::MutualTls {
description: Some(String::from("authorization is performed with client side certificate")),
extensions: None,
Expand Down

0 comments on commit ab0693d

Please sign in to comment.