From 477466f0531d5774db0dfc89d9dab68ce7b65155 Mon Sep 17 00:00:00 2001 From: Maksim Strebkov <257byte@gmail.com> Date: Sun, 30 Jun 2024 13:44:43 +0300 Subject: [PATCH] Adjust json schema type for BigInteger --- Tzkt.Api/Models/Accounts/Delegate.cs | 1 + Tzkt.Api/Models/Accounts/User.cs | 1 + Tzkt.Api/Models/Baking/StakingUpdate.cs | 2 ++ .../Models/Operations/IncreasePaidStorageOperation.cs | 2 ++ Tzkt.Api/Models/Operations/SetDepositsLimitOperation.cs | 2 ++ Tzkt.Api/Models/Operations/TransferTicketOperation.cs | 2 ++ Tzkt.Api/Models/Tickets/Ticket.cs | 4 ++++ Tzkt.Api/Models/Tickets/TicketBalance.cs | 2 ++ Tzkt.Api/Models/Tickets/TicketBalanceShort.cs | 2 ++ Tzkt.Api/Models/Tickets/TicketInfo.cs | 2 ++ Tzkt.Api/Models/Tickets/TicketTransfer.cs | 2 ++ Tzkt.Api/Models/Tokens/Token.cs | 4 ++++ Tzkt.Api/Models/Tokens/TokenBalance.cs | 3 +++ Tzkt.Api/Models/Tokens/TokenBalanceShort.cs | 2 ++ Tzkt.Api/Models/Tokens/TokenInfo.cs | 2 ++ Tzkt.Api/Models/Tokens/TokenInfoShort.cs | 1 + Tzkt.Api/Models/Tokens/TokenTransfer.cs | 2 ++ Tzkt.Api/Parameters/BigIntegerNullableParameter.cs | 8 ++++++++ 18 files changed, 44 insertions(+) diff --git a/Tzkt.Api/Models/Accounts/Delegate.cs b/Tzkt.Api/Models/Accounts/Delegate.cs index 03b60097..cdf1b51b 100644 --- a/Tzkt.Api/Models/Accounts/Delegate.cs +++ b/Tzkt.Api/Models/Accounts/Delegate.cs @@ -95,6 +95,7 @@ public class Delegate : Account /// /// Total amount of issued "pseudo-tokens". These pseudotokens are used for unstaking. /// + [JsonSchemaType(typeof(string), IsNullable = true)] public BigInteger? IssuedPseudotokens { get; set; } /// diff --git a/Tzkt.Api/Models/Accounts/User.cs b/Tzkt.Api/Models/Accounts/User.cs index 9734daf2..d7db52ca 100644 --- a/Tzkt.Api/Models/Accounts/User.cs +++ b/Tzkt.Api/Models/Accounts/User.cs @@ -57,6 +57,7 @@ public class User : Account /// /// Amount of "pseudo-tokens" received after staking. These pseudotokens are used for unstaking. /// + [JsonSchemaType(typeof(string), IsNullable = true)] public BigInteger? StakedPseudotokens { get; set; } /// diff --git a/Tzkt.Api/Models/Baking/StakingUpdate.cs b/Tzkt.Api/Models/Baking/StakingUpdate.cs index c10fbe23..e70ae279 100644 --- a/Tzkt.Api/Models/Baking/StakingUpdate.cs +++ b/Tzkt.Api/Models/Baking/StakingUpdate.cs @@ -1,4 +1,5 @@ using System.Numerics; +using NJsonSchema.Annotations; namespace Tzkt.Api.Models { @@ -49,6 +50,7 @@ public class StakingUpdate /// /// Amount of staking pseudotokens minted or burnt. /// + [JsonSchemaType(typeof(string), IsNullable = true)] public BigInteger? Pseudotokens { get; set; } /// diff --git a/Tzkt.Api/Models/Operations/IncreasePaidStorageOperation.cs b/Tzkt.Api/Models/Operations/IncreasePaidStorageOperation.cs index 840f9307..687caa35 100644 --- a/Tzkt.Api/Models/Operations/IncreasePaidStorageOperation.cs +++ b/Tzkt.Api/Models/Operations/IncreasePaidStorageOperation.cs @@ -1,4 +1,5 @@ using System.Numerics; +using NJsonSchema.Annotations; namespace Tzkt.Api.Models { @@ -90,6 +91,7 @@ public class IncreasePaidStorageOperation : Operation /// /// Amount of storage in bytes prepaid. /// + [JsonSchemaType(typeof(string), IsNullable = false)] public BigInteger Amount { get; set; } /// diff --git a/Tzkt.Api/Models/Operations/SetDepositsLimitOperation.cs b/Tzkt.Api/Models/Operations/SetDepositsLimitOperation.cs index 9471de7a..a6cea09f 100644 --- a/Tzkt.Api/Models/Operations/SetDepositsLimitOperation.cs +++ b/Tzkt.Api/Models/Operations/SetDepositsLimitOperation.cs @@ -1,4 +1,5 @@ using System.Numerics; +using NJsonSchema.Annotations; namespace Tzkt.Api.Models { @@ -75,6 +76,7 @@ public class SetDepositsLimitOperation : Operation /// /// Frozen deposits limit (mutez), or `null` if no limit. /// + [JsonSchemaType(typeof(string), IsNullable = true)] public BigInteger? Limit { get; set; } /// diff --git a/Tzkt.Api/Models/Operations/TransferTicketOperation.cs b/Tzkt.Api/Models/Operations/TransferTicketOperation.cs index 3e22cd55..bfe00d72 100644 --- a/Tzkt.Api/Models/Operations/TransferTicketOperation.cs +++ b/Tzkt.Api/Models/Operations/TransferTicketOperation.cs @@ -1,4 +1,5 @@ using System.Numerics; +using NJsonSchema.Annotations; namespace Tzkt.Api.Models { @@ -87,6 +88,7 @@ public class TransferTicketOperation : Operation /// /// Amount sent /// + [JsonSchemaType(typeof(string), IsNullable = false)] public BigInteger Amount { get; set; } /// diff --git a/Tzkt.Api/Models/Tickets/Ticket.cs b/Tzkt.Api/Models/Tickets/Ticket.cs index aa335219..b2cf0f36 100644 --- a/Tzkt.Api/Models/Tickets/Ticket.cs +++ b/Tzkt.Api/Models/Tickets/Ticket.cs @@ -1,5 +1,6 @@ using System.Numerics; using Netezos.Encoding; +using NJsonSchema.Annotations; namespace Tzkt.Api.Models { @@ -89,16 +90,19 @@ public class Ticket /// /// Total amount minted. /// + [JsonSchemaType(typeof(string), IsNullable = false)] public BigInteger TotalMinted { get; set; } /// /// Total amount burned. /// + [JsonSchemaType(typeof(string), IsNullable = false)] public BigInteger TotalBurned { get; set; } /// /// Total amount exists. /// + [JsonSchemaType(typeof(string), IsNullable = false)] public BigInteger TotalSupply { get; set; } } } diff --git a/Tzkt.Api/Models/Tickets/TicketBalance.cs b/Tzkt.Api/Models/Tickets/TicketBalance.cs index b7ce7559..be33975a 100644 --- a/Tzkt.Api/Models/Tickets/TicketBalance.cs +++ b/Tzkt.Api/Models/Tickets/TicketBalance.cs @@ -1,4 +1,5 @@ using System.Numerics; +using NJsonSchema.Annotations; namespace Tzkt.Api.Models { @@ -26,6 +27,7 @@ public class TicketBalance /// Balance. /// **[sortable]** /// + [JsonSchemaType(typeof(string), IsNullable = false)] public BigInteger Balance { get; set; } /// diff --git a/Tzkt.Api/Models/Tickets/TicketBalanceShort.cs b/Tzkt.Api/Models/Tickets/TicketBalanceShort.cs index d313a1c3..38c334e0 100644 --- a/Tzkt.Api/Models/Tickets/TicketBalanceShort.cs +++ b/Tzkt.Api/Models/Tickets/TicketBalanceShort.cs @@ -1,4 +1,5 @@ using System.Numerics; +using NJsonSchema.Annotations; namespace Tzkt.Api.Models { @@ -25,6 +26,7 @@ public class TicketBalanceShort /// /// Balance. /// + [JsonSchemaType(typeof(string), IsNullable = false)] public BigInteger Balance { get; set; } } } diff --git a/Tzkt.Api/Models/Tickets/TicketInfo.cs b/Tzkt.Api/Models/Tickets/TicketInfo.cs index ef88c288..9bd5e2c3 100644 --- a/Tzkt.Api/Models/Tickets/TicketInfo.cs +++ b/Tzkt.Api/Models/Tickets/TicketInfo.cs @@ -1,5 +1,6 @@ using System.Numerics; using Netezos.Encoding; +using NJsonSchema.Annotations; namespace Tzkt.Api.Models { @@ -43,6 +44,7 @@ public class TicketInfo /// /// Total amount exists. /// + [JsonSchemaType(typeof(string), IsNullable = false)] public BigInteger TotalSupply { get; set; } } } diff --git a/Tzkt.Api/Models/Tickets/TicketTransfer.cs b/Tzkt.Api/Models/Tickets/TicketTransfer.cs index 5f0ab5d8..8d66feda 100644 --- a/Tzkt.Api/Models/Tickets/TicketTransfer.cs +++ b/Tzkt.Api/Models/Tickets/TicketTransfer.cs @@ -1,4 +1,5 @@ using System.Numerics; +using NJsonSchema.Annotations; namespace Tzkt.Api.Models { @@ -43,6 +44,7 @@ public class TicketTransfer /// Amount of tickets transferred. /// **[sortable]** /// + [JsonSchemaType(typeof(string), IsNullable = false)] public BigInteger Amount { get; set; } /// diff --git a/Tzkt.Api/Models/Tokens/Token.cs b/Tzkt.Api/Models/Tokens/Token.cs index 5f97c0d5..7ca86891 100644 --- a/Tzkt.Api/Models/Tokens/Token.cs +++ b/Tzkt.Api/Models/Tokens/Token.cs @@ -20,6 +20,7 @@ public class Token /// Token id, unique within the contract. /// **[sortable]** /// + [JsonSchemaType(typeof(string), IsNullable = false)] public BigInteger TokenId { get; set; } /// @@ -75,16 +76,19 @@ public class Token /// /// Total number of minted tokens (raw value, not divided by `decimals`). /// + [JsonSchemaType(typeof(string), IsNullable = false)] public BigInteger TotalMinted { get; set; } /// /// Total number of burned tokens (raw value, not divided by `decimals`). /// + [JsonSchemaType(typeof(string), IsNullable = false)] public BigInteger TotalBurned { get; set; } /// /// Total number of existing tokens (raw value, not divided by `decimals`). /// + [JsonSchemaType(typeof(string), IsNullable = false)] public BigInteger TotalSupply { get; set; } /// diff --git a/Tzkt.Api/Models/Tokens/TokenBalance.cs b/Tzkt.Api/Models/Tokens/TokenBalance.cs index 98023c00..ff8c65c7 100644 --- a/Tzkt.Api/Models/Tokens/TokenBalance.cs +++ b/Tzkt.Api/Models/Tokens/TokenBalance.cs @@ -1,4 +1,5 @@ using System.Numerics; +using NJsonSchema.Annotations; namespace Tzkt.Api.Models { @@ -26,12 +27,14 @@ public class TokenBalance /// Balance (raw value, not divided by `decimals`). /// **[sortable]** /// + [JsonSchemaType(typeof(string), IsNullable = false)] public BigInteger Balance { get; set; } /// /// Balance value in mutez, based on the current token price. /// **[sortable]** /// + [JsonSchemaType(typeof(string), IsNullable = true)] public BigInteger? BalanceValue { get; set; } /// diff --git a/Tzkt.Api/Models/Tokens/TokenBalanceShort.cs b/Tzkt.Api/Models/Tokens/TokenBalanceShort.cs index 41045966..457be2b9 100644 --- a/Tzkt.Api/Models/Tokens/TokenBalanceShort.cs +++ b/Tzkt.Api/Models/Tokens/TokenBalanceShort.cs @@ -1,4 +1,5 @@ using System.Numerics; +using NJsonSchema.Annotations; namespace Tzkt.Api.Models { @@ -20,6 +21,7 @@ public class TokenBalanceShort /// Balance (raw value, not divided by `decimals`). /// **[sortable]** /// + [JsonSchemaType(typeof(string), IsNullable = false)] public BigInteger Balance { get; set; } } } diff --git a/Tzkt.Api/Models/Tokens/TokenInfo.cs b/Tzkt.Api/Models/Tokens/TokenInfo.cs index 78f5d03a..1c1e8435 100644 --- a/Tzkt.Api/Models/Tokens/TokenInfo.cs +++ b/Tzkt.Api/Models/Tokens/TokenInfo.cs @@ -18,6 +18,7 @@ public class TokenInfo /// /// Token id, unique within the contract. /// + [JsonSchemaType(typeof(string), IsNullable = false)] public BigInteger TokenId { get; set; } /// @@ -28,6 +29,7 @@ public class TokenInfo /// /// Total number of existing tokens (raw value, not divided by `decimals`). /// + [JsonSchemaType(typeof(string), IsNullable = false)] public BigInteger TotalSupply { get; set; } /// diff --git a/Tzkt.Api/Models/Tokens/TokenInfoShort.cs b/Tzkt.Api/Models/Tokens/TokenInfoShort.cs index a222c65a..ff1f3591 100644 --- a/Tzkt.Api/Models/Tokens/TokenInfoShort.cs +++ b/Tzkt.Api/Models/Tokens/TokenInfoShort.cs @@ -18,6 +18,7 @@ public class TokenInfoShort /// /// Token id, unique within the contract. /// + [JsonSchemaType(typeof(string), IsNullable = false)] public BigInteger TokenId { get; set; } /// diff --git a/Tzkt.Api/Models/Tokens/TokenTransfer.cs b/Tzkt.Api/Models/Tokens/TokenTransfer.cs index a2b5251a..7f2ae639 100644 --- a/Tzkt.Api/Models/Tokens/TokenTransfer.cs +++ b/Tzkt.Api/Models/Tokens/TokenTransfer.cs @@ -1,4 +1,5 @@ using System.Numerics; +using NJsonSchema.Annotations; namespace Tzkt.Api.Models { @@ -43,6 +44,7 @@ public class TokenTransfer /// Amount of tokens transferred (raw value, not divided by `decimals`). /// **[sortable]** /// + [JsonSchemaType(typeof(string), IsNullable = false)] public BigInteger Amount { get; set; } /// diff --git a/Tzkt.Api/Parameters/BigIntegerNullableParameter.cs b/Tzkt.Api/Parameters/BigIntegerNullableParameter.cs index 7004a3d2..db2cd3a3 100644 --- a/Tzkt.Api/Parameters/BigIntegerNullableParameter.cs +++ b/Tzkt.Api/Parameters/BigIntegerNullableParameter.cs @@ -15,6 +15,7 @@ public class BigIntegerNullableParameter : INormalizable /// /// Example: `?balance=1234`. /// + [JsonSchemaType(typeof(string), IsNullable = true)] public BigInteger? Eq { get; set; } /// @@ -23,6 +24,7 @@ public class BigIntegerNullableParameter : INormalizable /// /// Example: `?balance.ne=1234`. /// + [JsonSchemaType(typeof(string), IsNullable = true)] public BigInteger? Ne { get; set; } /// @@ -31,6 +33,7 @@ public class BigIntegerNullableParameter : INormalizable /// /// Example: `?balance.gt=1234`. /// + [JsonSchemaType(typeof(string), IsNullable = true)] public BigInteger? Gt { get; set; } /// @@ -39,6 +42,7 @@ public class BigIntegerNullableParameter : INormalizable /// /// Example: `?balance.ge=1234`. /// + [JsonSchemaType(typeof(string), IsNullable = true)] public BigInteger? Ge { get; set; } /// @@ -47,6 +51,7 @@ public class BigIntegerNullableParameter : INormalizable /// /// Example: `?balance.lt=1234`. /// + [JsonSchemaType(typeof(string), IsNullable = true)] public BigInteger? Lt { get; set; } /// @@ -55,6 +60,7 @@ public class BigIntegerNullableParameter : INormalizable /// /// Example: `?balance.le=1234`. /// + [JsonSchemaType(typeof(string), IsNullable = true)] public BigInteger? Le { get; set; } /// @@ -63,6 +69,7 @@ public class BigIntegerNullableParameter : INormalizable /// /// Example: `?level.in=12,14,52,69`. /// + [JsonSchemaType(typeof(List), IsNullable = true)] public List In { get; set; } /// @@ -71,6 +78,7 @@ public class BigIntegerNullableParameter : INormalizable /// /// Example: `?level.ni=12,14,52,69`. /// + [JsonSchemaType(typeof(List), IsNullable = true)] public List Ni { get; set; } ///