Skip to content

Commit

Permalink
Merge pull request #610 from BitcreditProtocol/peanut/swagger_type
Browse files Browse the repository at this point in the history
fix openApi attributes to keyset id to present it as a string
  • Loading branch information
thesimplekid authored Feb 21, 2025
2 parents e1458b0 + 606385f commit 6e86235
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
3 changes: 3 additions & 0 deletions crates/cashu/src/nuts/nut00/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ pub struct BlindedMessage {
///
/// ID from which we expect a signature.
#[serde(rename = "id")]
#[cfg_attr(feature = "swagger", schema(value_type = String))]
pub keyset_id: Id,
/// Blinded secret message (B_)
///
Expand Down Expand Up @@ -161,6 +162,7 @@ pub struct BlindSignature {
///
/// ID of the mint keys that signed the token.
#[serde(rename = "id")]
#[cfg_attr(feature = "swagger", schema(value_type = String))]
pub keyset_id: Id,
/// Blinded signature (C_)
///
Expand Down Expand Up @@ -240,6 +242,7 @@ pub struct Proof {
pub amount: Amount,
/// `Keyset id`
#[serde(rename = "id")]
#[cfg_attr(feature = "swagger", schema(value_type = String))]
pub keyset_id: Id,
/// Secret message
#[cfg_attr(feature = "swagger", schema(value_type = String))]
Expand Down
4 changes: 2 additions & 2 deletions crates/cashu/src/nuts/nut02.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ pub enum Error {

/// Keyset version
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[cfg_attr(feature = "swagger", derive(utoipa::ToSchema))]
pub enum KeySetVersion {
/// Current Version 00
Version00,
Expand Down Expand Up @@ -88,7 +87,6 @@ impl fmt::Display for KeySetVersion {
/// which mint or keyset it was generated from.
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize)]
#[serde(into = "String", try_from = "String")]
#[cfg_attr(feature = "swagger", derive(utoipa::ToSchema), schema(as = String))]
pub struct Id {
version: KeySetVersion,
id: [u8; Self::BYTELEN],
Expand Down Expand Up @@ -221,6 +219,7 @@ pub struct KeysetResponse {
#[cfg_attr(feature = "swagger", derive(utoipa::ToSchema))]
pub struct KeySet {
/// Keyset [`Id`]
#[cfg_attr(feature = "swagger", schema(value_type = String))]
pub id: Id,
/// Keyset [`CurrencyUnit`]
pub unit: CurrencyUnit,
Expand Down Expand Up @@ -257,6 +256,7 @@ impl From<MintKeySet> for KeySet {
#[cfg_attr(feature = "swagger", derive(utoipa::ToSchema))]
pub struct KeySetInfo {
/// Keyset [`Id`]
#[cfg_attr(feature = "swagger", schema(value_type = String))]
pub id: Id,
/// Keyset [`CurrencyUnit`]
pub unit: CurrencyUnit,
Expand Down
4 changes: 1 addition & 3 deletions crates/cdk-axum/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ mod swagger_imports {
BlindSignature, BlindedMessage, CurrencyUnit, PaymentMethod, Proof, Witness,
};
pub use cdk::nuts::nut01::{Keys, KeysResponse, PublicKey, SecretKey};
pub use cdk::nuts::nut02::{Id, KeySet, KeySetInfo, KeySetVersion, KeysetResponse};
pub use cdk::nuts::nut02::{KeySet, KeySetInfo, KeysetResponse};
pub use cdk::nuts::nut03::{SwapRequest, SwapResponse};
pub use cdk::nuts::nut04::{
MintBolt11Request, MintBolt11Response, MintMethodSettings, MintQuoteBolt11Request,
Expand Down Expand Up @@ -70,13 +70,11 @@ pub struct MintState {
ErrorCode,
ErrorResponse,
HTLCWitness,
Id,
Keys,
KeysResponse,
KeysetResponse,
KeySet,
KeySetInfo,
KeySetVersion,
MeltBolt11Request<Uuid>,
MeltQuoteBolt11Request,
MeltQuoteBolt11Response<Uuid>,
Expand Down

0 comments on commit 6e86235

Please sign in to comment.