41fb17a31b
* WIP adding derive(ToSchema) * Derive ToSchema for more types * ContractBuildInformation on /nym_contracts_detailed * rustfmt * Add cfg_attr * A bunch of annotations * Compiles with utoipa 5.2 * WIP * Post rebase fixes * Gitattributes to ignore .sqlx diffs * generate Sqlx schema files * Improvements * Move ecash schema out of ecash crate * Move redocly config to nym-api/ * Move redocly config to nym-api/ * Remove ErrorResponse * Move generated openapi spec to .gitignore * Include BSL licence * Remove utoipa from ecash toml file * Remove placeholder annotations * Chain-watcher rebase changes * Update licence info * Treat Scalar as String in OpenAPI
49 lines
2.0 KiB
Rust
49 lines
2.0 KiB
Rust
// Copyright 2023-2024 - Nym Technologies SA <contact@nymtech.net>
|
|
// SPDX-License-Identifier: GPL-3.0-only
|
|
|
|
#![allow(deprecated)]
|
|
use crate::network::handlers::ContractVersionSchemaResponse;
|
|
use utoipa::OpenApi;
|
|
use utoipauto::utoipauto;
|
|
|
|
// TODO once https://github.com/ProbablyClem/utoipauto/pull/38 is released:
|
|
// include ",./nym-api/nym-api-requests/src from nym-api-requests" (and other packages mentioned below)
|
|
// for automatic model discovery based on ToSchema / IntoParams implementation.
|
|
// Then you can remove `components(schemas)` manual imports below
|
|
|
|
// dependencies which have derive(ToSchema) behind a feature flag with cfg_attr
|
|
// cannot be autodiscovered because proc macros run before feature flags.
|
|
// Tracking issue: https://github.com/ProbablyClem/utoipauto/issues/13
|
|
|
|
#[utoipauto(paths = "./nym-api/src,
|
|
./nym-api/nym-api-requests/src from nym-api-requests,
|
|
./common/config/src from nym-config,
|
|
./common/ticketbooks-merkle/src from nym-ticketbooks-merkle,
|
|
./common/nym_offline_compact_ecash/src from nym_compact_ecash")]
|
|
#[derive(OpenApi)]
|
|
#[openapi(
|
|
info(title = "Nym API"),
|
|
servers(
|
|
(url = "/api", description = "Main Nym Api Server"),
|
|
(url = "/", description = "Auxiliary Nym Api Instances"),
|
|
(url = "/", description = "Local Development Server")
|
|
),
|
|
tags(),
|
|
components(schemas(
|
|
nym_mixnet_contract_common::Interval,
|
|
nym_mixnet_contract_common::IntervalRewardParams,
|
|
nym_mixnet_contract_common::RewardingParams,
|
|
nym_mixnet_contract_common::reward_params::RewardedSetParams,
|
|
nym_config::defaults::NymNetworkDetails,
|
|
nym_config::defaults::ChainDetails,
|
|
nym_config::defaults::DenomDetailsOwned,
|
|
nym_config::defaults::ValidatorDetails,
|
|
nym_config::defaults::NymContracts,
|
|
ContractVersionSchemaResponse,
|
|
nym_bin_common::build_information::BinaryBuildInformationOwned,
|
|
nym_node_requests::api::v1::node::models::AuxiliaryDetails,
|
|
nym_contracts_common::ContractBuildInformation
|
|
))
|
|
)]
|
|
pub(crate) struct ApiDoc;
|