From c7e9575ee1366c248b3d89ad830f8666cd7e07c0 Mon Sep 17 00:00:00 2001 From: Tiago Castro Date: Thu, 27 Jun 2024 22:23:28 +0100 Subject: [PATCH] fix: add missing tos (#522) Adds missing tos from openapi info. Signed-off-by: Tiago Castro --- core/src/v2/models.rs | 2 ++ core/src/v3/info.rs | 2 +- tests/test_app.rs | 2 ++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/core/src/v2/models.rs b/core/src/v2/models.rs index 66055fb7d..a2882e855 100644 --- a/core/src/v2/models.rs +++ b/core/src/v2/models.rs @@ -306,6 +306,8 @@ pub struct Info { pub title: String, #[serde(skip_serializing_if = "Option::is_none")] pub description: Option, + #[serde(rename = "termsOfService", skip_serializing_if = "Option::is_none")] + pub terms_of_service: Option, #[serde(skip_serializing_if = "Option::is_none")] pub contact: Option, #[serde(skip_serializing_if = "Option::is_none")] diff --git a/core/src/v3/info.rs b/core/src/v3/info.rs index 1afb64700..1437f70f9 100644 --- a/core/src/v3/info.rs +++ b/core/src/v3/info.rs @@ -5,7 +5,7 @@ impl From for openapiv3::Info { openapiv3::Info { title: v2.title, description: v2.description, - terms_of_service: None, + terms_of_service: v2.terms_of_service, contact: v2.contact.map(|c| c.into()), license: v2.license.map(From::from), version: v2.version, diff --git a/tests/test_app.rs b/tests/test_app.rs index 8d12a66bb..926ae01bf 100644 --- a/tests/test_app.rs +++ b/tests/test_app.rs @@ -2389,6 +2389,7 @@ fn test_tags() { spec.info = Info { version: "0.1".into(), title: "Image server".into(), + terms_of_service: Some("http://test.io/terms/".into()), extensions, ..Default::default() }; @@ -2439,6 +2440,7 @@ fn test_tags() { "info":{ "title":"Image server", "version":"0.1", + "termsOfService":"http://test.io/terms/", "x-my-attr":true }, "x-root-level-extension": false,