From 13e64da2ad4fe6dc8b1d240d2b17992cd5663ff0 Mon Sep 17 00:00:00 2001 From: dynco-nym <173912580+dynco-nym@users.noreply.github.com> Date: Mon, 9 Dec 2024 22:01:06 +0100 Subject: [PATCH] ContractBuildInformation on /nym_contracts_detailed --- Cargo.lock | 1 + common/cosmwasm-smart-contracts/contracts-common/Cargo.toml | 2 ++ common/cosmwasm-smart-contracts/contracts-common/src/types.rs | 1 + nym-api/Cargo.toml | 2 +- nym-api/src/support/http/openapi.rs | 1 + 5 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Cargo.lock b/Cargo.lock index 8aa965aae4..59cf540284 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4995,6 +4995,7 @@ dependencies = [ "serde", "serde_json", "thiserror", + "utoipa", "vergen", ] diff --git a/common/cosmwasm-smart-contracts/contracts-common/Cargo.toml b/common/cosmwasm-smart-contracts/contracts-common/Cargo.toml index f137d19d66..4a80db6afa 100644 --- a/common/cosmwasm-smart-contracts/contracts-common/Cargo.toml +++ b/common/cosmwasm-smart-contracts/contracts-common/Cargo.toml @@ -13,6 +13,7 @@ cosmwasm-std = { workspace = true } cosmwasm-schema = { workspace = true } cw-storage-plus = { workspace = true } schemars = { workspace = true } +utoipa = { workspace = true, optional = true } serde = { workspace = true, features = ["derive"] } thiserror = { workspace = true } @@ -24,3 +25,4 @@ vergen = { workspace = true, features = ["build", "git", "gitcl", "rustc", "carg [features] naive_float = [] +utoipa = ["dep:utoipa"] diff --git a/common/cosmwasm-smart-contracts/contracts-common/src/types.rs b/common/cosmwasm-smart-contracts/contracts-common/src/types.rs index 320658662e..456fd45a76 100644 --- a/common/cosmwasm-smart-contracts/contracts-common/src/types.rs +++ b/common/cosmwasm-smart-contracts/contracts-common/src/types.rs @@ -221,6 +221,7 @@ fn default_unknown() -> String { // TODO: there's no reason this couldn't be used for proper binaries, but in that case // perhaps the struct should get renamed and moved to a "more" common crate #[cw_serde] +#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))] pub struct ContractBuildInformation { /// Provides the name of the binary, i.e. the content of `CARGO_PKG_NAME` environmental variable. #[serde(default = "default_unknown")] diff --git a/nym-api/Cargo.toml b/nym-api/Cargo.toml index 27814af1db..e931625fdf 100644 --- a/nym-api/Cargo.toml +++ b/nym-api/Cargo.toml @@ -105,7 +105,7 @@ nym-gateway-client = { path = "../common/client-libs/gateway-client" } nym-inclusion-probability = { path = "../common/inclusion-probability" } nym-mixnet-contract-common = { path = "../common/cosmwasm-smart-contracts/mixnet-contract", features = ["utoipa"] } nym-vesting-contract-common = { path = "../common/cosmwasm-smart-contracts/vesting-contract" } -nym-contracts-common = { path = "../common/cosmwasm-smart-contracts/contracts-common", features = ["naive_float"] } +nym-contracts-common = { path = "../common/cosmwasm-smart-contracts/contracts-common", features = ["naive_float", "utoipa"] } nym-multisig-contract-common = { path = "../common/cosmwasm-smart-contracts/multisig-contract" } nym-coconut = { path = "../common/nymcoconut", features = ["key-zeroize"] } nym-sphinx = { path = "../common/nymsphinx" } diff --git a/nym-api/src/support/http/openapi.rs b/nym-api/src/support/http/openapi.rs index f17f27553a..d7414aa1f1 100644 --- a/nym-api/src/support/http/openapi.rs +++ b/nym-api/src/support/http/openapi.rs @@ -40,6 +40,7 @@ use utoipauto::utoipauto; ContractVersionSchemaResponse, nym_bin_common::build_information::BinaryBuildInformationOwned, nym_node_requests::api::v1::node::models::AuxiliaryDetails, + nym_contracts_common::ContractBuildInformation )) )] pub(crate) struct ApiDoc;