diff --git a/CHANGELOG.md b/CHANGELOG.md index a1fccb070f..7174d96d51 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,8 @@ and this project adheres to ECDSA signature verification over secp256r1. ([#1983], [#2057], [#2058]) - cosmwasm-vm: Add metrics for the pinned memory cache ([#2059]) - cosmwasm-derive: The crate used in the expansion can now be renamed ([#2068]) +- cosmwasm-schema-derive: The crate used in the expansion can now be renamed + ([#2070]) - cosmwasm-std: The decimal types now implement `TryFrom` for their respective integer representations ([#2075]) @@ -26,10 +28,18 @@ and this project adheres to - cosmwasm-std: Enable `add_event` and `add_events` functions to process types implementing `Into` ([#2044]) - cosmwasm-vm: Improve performance of the `Cache::analyze` function ([#2051]) +- cosmwasm-derive: Update to `syn` v2 ([#2063]) +- cosmwasm-schema-derive: Update to `syn` v2 ([#2063]) +- cosmwasm-schema-derive: Improve emitted error messages ([#2063]) +- cosmwasm-schema: `#[cw_serde]` now doesn't add `#[serde(deny_unknown_fields)]` + to the expanded code anymore ([#2080]) [#2044]: https://github.com/CosmWasm/cosmwasm/pull/2044 [#2051]: https://github.com/CosmWasm/cosmwasm/pull/2051 [#2059]: https://github.com/CosmWasm/cosmwasm/pull/2059 +[#2063]: https://github.com/CosmWasm/cosmwasm/pull/2063 +[#2070]: https://github.com/CosmWasm/cosmwasm/pull/2070 +[#2080]: https://github.com/CosmWasm/cosmwasm/pull/2080 ## [2.0.1] - 2024-04-03 diff --git a/contracts/cyberpunk/schema/cyberpunk.json b/contracts/cyberpunk/schema/cyberpunk.json index 0660511517..dbabc26fb4 100644 --- a/contracts/cyberpunk/schema/cyberpunk.json +++ b/contracts/cyberpunk/schema/cyberpunk.json @@ -6,7 +6,8 @@ "$schema": "http://json-schema.org/draft-07/schema#", "title": "InstantiateMsg", "description": "An empty struct that serves as a placeholder in different places, such as contracts that don't set a custom message.\n\nIt is designed to be expressable in correct JSON and JSON Schema but contains no meaningful data. Previously we used enums without cases, but those cannot represented as valid JSON Schema (https://github.com/CosmWasm/cosmwasm/issues/451)", - "type": "object" + "type": "object", + "additionalProperties": false }, "execute": { "$schema": "http://json-schema.org/draft-07/schema#", @@ -299,6 +300,7 @@ "type": "string" } }, + "additionalProperties": false, "definitions": { "DenomUnit": { "description": "Replicates the cosmos-sdk bank module DenomUnit type", @@ -323,7 +325,8 @@ "format": "uint32", "minimum": 0.0 } - } + }, + "additionalProperties": false } } }, @@ -376,7 +379,8 @@ "uri_hash": { "type": "string" } - } + }, + "additionalProperties": false }, "DenomUnit": { "description": "Replicates the cosmos-sdk bank module DenomUnit type", @@ -401,7 +405,8 @@ "format": "uint32", "minimum": 0.0 } - } + }, + "additionalProperties": false } } }, @@ -432,6 +437,7 @@ ] } }, + "additionalProperties": false, "definitions": { "Addr": { "description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.", @@ -462,7 +468,8 @@ } ] } - } + }, + "additionalProperties": false }, "ContractInfo": { "type": "object", @@ -473,7 +480,8 @@ "address": { "$ref": "#/definitions/Addr" } - } + }, + "additionalProperties": false }, "Timestamp": { "description": "A point in time in nanosecond precision.\n\nThis type can represent times from 1970-01-01T00:00:00Z to 2554-07-21T23:34:33Z.\n\n## Examples\n\n``` # use cosmwasm_std::Timestamp; let ts = Timestamp::from_nanos(1_000_000_202); assert_eq!(ts.nanos(), 1_000_000_202); assert_eq!(ts.seconds(), 1); assert_eq!(ts.subsec_nanos(), 202);\n\nlet ts = ts.plus_seconds(2); assert_eq!(ts.nanos(), 3_000_000_202); assert_eq!(ts.seconds(), 3); assert_eq!(ts.subsec_nanos(), 202); ```", @@ -495,7 +503,8 @@ "format": "uint32", "minimum": 0.0 } - } + }, + "additionalProperties": false }, "Uint64": { "description": "A thin wrapper around u64 that is using strings for JSON encoding/decoding, such that the full u64 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u64` to get the value out:\n\n``` # use cosmwasm_std::Uint64; let a = Uint64::from(42u64); assert_eq!(a.u64(), 42);\n\nlet b = Uint64::from(70u32); assert_eq!(b.u64(), 70); ```", diff --git a/contracts/cyberpunk/schema/raw/instantiate.json b/contracts/cyberpunk/schema/raw/instantiate.json index 5f6dfaf43c..d7966224ed 100644 --- a/contracts/cyberpunk/schema/raw/instantiate.json +++ b/contracts/cyberpunk/schema/raw/instantiate.json @@ -2,5 +2,6 @@ "$schema": "http://json-schema.org/draft-07/schema#", "title": "InstantiateMsg", "description": "An empty struct that serves as a placeholder in different places, such as contracts that don't set a custom message.\n\nIt is designed to be expressable in correct JSON and JSON Schema but contains no meaningful data. Previously we used enums without cases, but those cannot represented as valid JSON Schema (https://github.com/CosmWasm/cosmwasm/issues/451)", - "type": "object" + "type": "object", + "additionalProperties": false } diff --git a/contracts/cyberpunk/schema/raw/response_to_denom.json b/contracts/cyberpunk/schema/raw/response_to_denom.json index b541da804b..3cf72b4ed6 100644 --- a/contracts/cyberpunk/schema/raw/response_to_denom.json +++ b/contracts/cyberpunk/schema/raw/response_to_denom.json @@ -42,6 +42,7 @@ "type": "string" } }, + "additionalProperties": false, "definitions": { "DenomUnit": { "description": "Replicates the cosmos-sdk bank module DenomUnit type", @@ -66,7 +67,8 @@ "format": "uint32", "minimum": 0.0 } - } + }, + "additionalProperties": false } } } diff --git a/contracts/cyberpunk/schema/raw/response_to_denoms.json b/contracts/cyberpunk/schema/raw/response_to_denoms.json index e8fcd9a16e..f8c7afab75 100644 --- a/contracts/cyberpunk/schema/raw/response_to_denoms.json +++ b/contracts/cyberpunk/schema/raw/response_to_denoms.json @@ -47,7 +47,8 @@ "uri_hash": { "type": "string" } - } + }, + "additionalProperties": false }, "DenomUnit": { "description": "Replicates the cosmos-sdk bank module DenomUnit type", @@ -72,7 +73,8 @@ "format": "uint32", "minimum": 0.0 } - } + }, + "additionalProperties": false } } } diff --git a/contracts/cyberpunk/schema/raw/response_to_mirror_env.json b/contracts/cyberpunk/schema/raw/response_to_mirror_env.json index a14d618225..6d4e75e50b 100644 --- a/contracts/cyberpunk/schema/raw/response_to_mirror_env.json +++ b/contracts/cyberpunk/schema/raw/response_to_mirror_env.json @@ -25,6 +25,7 @@ ] } }, + "additionalProperties": false, "definitions": { "Addr": { "description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.", @@ -55,7 +56,8 @@ } ] } - } + }, + "additionalProperties": false }, "ContractInfo": { "type": "object", @@ -66,7 +68,8 @@ "address": { "$ref": "#/definitions/Addr" } - } + }, + "additionalProperties": false }, "Timestamp": { "description": "A point in time in nanosecond precision.\n\nThis type can represent times from 1970-01-01T00:00:00Z to 2554-07-21T23:34:33Z.\n\n## Examples\n\n``` # use cosmwasm_std::Timestamp; let ts = Timestamp::from_nanos(1_000_000_202); assert_eq!(ts.nanos(), 1_000_000_202); assert_eq!(ts.seconds(), 1); assert_eq!(ts.subsec_nanos(), 202);\n\nlet ts = ts.plus_seconds(2); assert_eq!(ts.nanos(), 3_000_000_202); assert_eq!(ts.seconds(), 3); assert_eq!(ts.subsec_nanos(), 202); ```", @@ -88,7 +91,8 @@ "format": "uint32", "minimum": 0.0 } - } + }, + "additionalProperties": false }, "Uint64": { "description": "A thin wrapper around u64 that is using strings for JSON encoding/decoding, such that the full u64 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u64` to get the value out:\n\n``` # use cosmwasm_std::Uint64; let a = Uint64::from(42u64); assert_eq!(a.u64(), 42);\n\nlet b = Uint64::from(70u32); assert_eq!(b.u64(), 70); ```", diff --git a/contracts/floaty/schema/floaty.json b/contracts/floaty/schema/floaty.json index cd80c14339..b4327d2585 100644 --- a/contracts/floaty/schema/floaty.json +++ b/contracts/floaty/schema/floaty.json @@ -6,7 +6,8 @@ "$schema": "http://json-schema.org/draft-07/schema#", "title": "InstantiateMsg", "description": "An empty struct that serves as a placeholder in different places, such as contracts that don't set a custom message.\n\nIt is designed to be expressable in correct JSON and JSON Schema but contains no meaningful data. Previously we used enums without cases, but those cannot represented as valid JSON Schema (https://github.com/CosmWasm/cosmwasm/issues/451)", - "type": "object" + "type": "object", + "additionalProperties": false }, "execute": null, "query": { diff --git a/contracts/floaty/schema/raw/instantiate.json b/contracts/floaty/schema/raw/instantiate.json index 5f6dfaf43c..d7966224ed 100644 --- a/contracts/floaty/schema/raw/instantiate.json +++ b/contracts/floaty/schema/raw/instantiate.json @@ -2,5 +2,6 @@ "$schema": "http://json-schema.org/draft-07/schema#", "title": "InstantiateMsg", "description": "An empty struct that serves as a placeholder in different places, such as contracts that don't set a custom message.\n\nIt is designed to be expressable in correct JSON and JSON Schema but contains no meaningful data. Previously we used enums without cases, but those cannot represented as valid JSON Schema (https://github.com/CosmWasm/cosmwasm/issues/451)", - "type": "object" + "type": "object", + "additionalProperties": false } diff --git a/contracts/hackatom/schema/hackatom.json b/contracts/hackatom/schema/hackatom.json index 23ee0acdb8..307c89871f 100644 --- a/contracts/hackatom/schema/hackatom.json +++ b/contracts/hackatom/schema/hackatom.json @@ -297,7 +297,8 @@ "denom": { "type": "string" } - } + }, + "additionalProperties": false }, "Uint128": { "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", @@ -338,6 +339,7 @@ } } }, + "additionalProperties": false, "definitions": { "Coin": { "type": "object", @@ -352,7 +354,8 @@ "denom": { "type": "string" } - } + }, + "additionalProperties": false }, "Uint128": { "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", diff --git a/contracts/hackatom/schema/raw/response_to_other_balance.json b/contracts/hackatom/schema/raw/response_to_other_balance.json index 20f0a47f1c..46aa76ef1b 100644 --- a/contracts/hackatom/schema/raw/response_to_other_balance.json +++ b/contracts/hackatom/schema/raw/response_to_other_balance.json @@ -14,6 +14,7 @@ } } }, + "additionalProperties": false, "definitions": { "Coin": { "type": "object", @@ -28,7 +29,8 @@ "denom": { "type": "string" } - } + }, + "additionalProperties": false }, "Uint128": { "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", diff --git a/contracts/hackatom/schema/raw/sudo.json b/contracts/hackatom/schema/raw/sudo.json index d41253aeb0..5391911bd6 100644 --- a/contracts/hackatom/schema/raw/sudo.json +++ b/contracts/hackatom/schema/raw/sudo.json @@ -46,7 +46,8 @@ "denom": { "type": "string" } - } + }, + "additionalProperties": false }, "Uint128": { "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", diff --git a/contracts/ibc-reflect-send/schema/ibc-reflect-send.json b/contracts/ibc-reflect-send/schema/ibc-reflect-send.json index 359f005dbd..4f1ede3a7c 100644 --- a/contracts/ibc-reflect-send/schema/ibc-reflect-send.json +++ b/contracts/ibc-reflect-send/schema/ibc-reflect-send.json @@ -140,7 +140,8 @@ "to_address": { "type": "string" } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -164,7 +165,8 @@ "$ref": "#/definitions/Coin" } } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -188,7 +190,8 @@ "denom": { "type": "string" } - } + }, + "additionalProperties": false }, "CosmosMsg_for_Empty": { "oneOf": [ @@ -324,7 +327,8 @@ "description": "The `withdraw_address`", "type": "string" } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -346,7 +350,8 @@ "description": "The `validator_address`", "type": "string" } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -355,7 +360,8 @@ }, "Empty": { "description": "An empty struct that serves as a placeholder in different places, such as contracts that don't set a custom message.\n\nIt is designed to be expressable in correct JSON and JSON Schema but contains no meaningful data. Previously we used enums without cases, but those cannot represented as valid JSON Schema (https://github.com/CosmWasm/cosmwasm/issues/451)", - "type": "object" + "type": "object", + "additionalProperties": false }, "GovMsg": { "description": "This message type allows the contract interact with the [x/gov] module in order to cast votes.\n\n[x/gov]: https://github.com/cosmos/cosmos-sdk/tree/v0.45.12/x/gov\n\n## Examples\n\nCast a simple vote:\n\n``` # use cosmwasm_std::{ # HexBinary, # Storage, Api, Querier, DepsMut, Deps, entry_point, Env, StdError, MessageInfo, # Response, QueryResponse, # }; # type ExecuteMsg = (); use cosmwasm_std::{GovMsg, VoteOption};\n\n#[entry_point] pub fn execute( deps: DepsMut, env: Env, info: MessageInfo, msg: ExecuteMsg, ) -> Result { // ... Ok(Response::new().add_message(GovMsg::Vote { proposal_id: 4, option: VoteOption::Yes, })) } ```\n\nCast a weighted vote:\n\n``` # use cosmwasm_std::{ # HexBinary, # Storage, Api, Querier, DepsMut, Deps, entry_point, Env, StdError, MessageInfo, # Response, QueryResponse, # }; # type ExecuteMsg = (); # #[cfg(feature = \"cosmwasm_1_2\")] use cosmwasm_std::{Decimal, GovMsg, VoteOption, WeightedVoteOption};\n\n# #[cfg(feature = \"cosmwasm_1_2\")] #[entry_point] pub fn execute( deps: DepsMut, env: Env, info: MessageInfo, msg: ExecuteMsg, ) -> Result { // ... Ok(Response::new().add_message(GovMsg::VoteWeighted { proposal_id: 4, options: vec![ WeightedVoteOption { option: VoteOption::Yes, weight: Decimal::percent(65), }, WeightedVoteOption { option: VoteOption::Abstain, weight: Decimal::percent(35), }, ], })) } ```", @@ -387,7 +393,8 @@ "format": "uint64", "minimum": 0.0 } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -444,7 +451,8 @@ "description": "address on the remote chain to receive these tokens", "type": "string" } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -478,7 +486,8 @@ } ] } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -499,7 +508,8 @@ "channel_id": { "type": "string" } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -530,7 +540,8 @@ } ] } - } + }, + "additionalProperties": false }, "IbcTimeoutBlock": { "description": "IBCTimeoutHeight Height is a monotonically increasing data type that can be compared against another Height for the purposes of updating and freezing clients. Ordering is (revision_number, timeout_height)", @@ -552,7 +563,8 @@ "format": "uint64", "minimum": 0.0 } - } + }, + "additionalProperties": false }, "StakingMsg": { "description": "The message types of the staking module.\n\nSee https://github.com/cosmos/cosmos-sdk/blob/v0.40.0/proto/cosmos/staking/v1beta1/tx.proto", @@ -577,7 +589,8 @@ "validator": { "type": "string" } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -602,7 +615,8 @@ "validator": { "type": "string" } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -631,7 +645,8 @@ "src_validator": { "type": "string" } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -698,7 +713,8 @@ } ] } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -748,7 +764,8 @@ } ] } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -785,7 +802,8 @@ "format": "uint64", "minimum": 0.0 } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -810,7 +828,8 @@ "contract_addr": { "type": "string" } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -831,7 +850,8 @@ "contract_addr": { "type": "string" } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -946,7 +966,8 @@ "denom": { "type": "string" } - } + }, + "additionalProperties": false }, "Timestamp": { "description": "A point in time in nanosecond precision.\n\nThis type can represent times from 1970-01-01T00:00:00Z to 2554-07-21T23:34:33Z.\n\n## Examples\n\n``` # use cosmwasm_std::Timestamp; let ts = Timestamp::from_nanos(1_000_000_202); assert_eq!(ts.nanos(), 1_000_000_202); assert_eq!(ts.seconds(), 1); assert_eq!(ts.subsec_nanos(), 202);\n\nlet ts = ts.plus_seconds(2); assert_eq!(ts.nanos(), 3_000_000_202); assert_eq!(ts.seconds(), 3); assert_eq!(ts.subsec_nanos(), 202); ```", @@ -1045,7 +1066,8 @@ "denom": { "type": "string" } - } + }, + "additionalProperties": false }, "Timestamp": { "description": "A point in time in nanosecond precision.\n\nThis type can represent times from 1970-01-01T00:00:00Z to 2554-07-21T23:34:33Z.\n\n## Examples\n\n``` # use cosmwasm_std::Timestamp; let ts = Timestamp::from_nanos(1_000_000_202); assert_eq!(ts.nanos(), 1_000_000_202); assert_eq!(ts.seconds(), 1); assert_eq!(ts.subsec_nanos(), 202);\n\nlet ts = ts.plus_seconds(2); assert_eq!(ts.nanos(), 3_000_000_202); assert_eq!(ts.seconds(), 3); assert_eq!(ts.subsec_nanos(), 202); ```", diff --git a/contracts/ibc-reflect-send/schema/ibc/acknowledgement_msg_balances.json b/contracts/ibc-reflect-send/schema/ibc/acknowledgement_msg_balances.json index 4bde7573d0..4f6447522d 100644 --- a/contracts/ibc-reflect-send/schema/ibc/acknowledgement_msg_balances.json +++ b/contracts/ibc-reflect-send/schema/ibc/acknowledgement_msg_balances.json @@ -46,7 +46,8 @@ "$ref": "#/definitions/Coin" } } - } + }, + "additionalProperties": false }, "Coin": { "type": "object", @@ -61,7 +62,8 @@ "denom": { "type": "string" } - } + }, + "additionalProperties": false }, "Uint128": { "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", diff --git a/contracts/ibc-reflect-send/schema/ibc/acknowledgement_msg_who_am_i.json b/contracts/ibc-reflect-send/schema/ibc/acknowledgement_msg_who_am_i.json index e4ad97424b..f706c655de 100644 --- a/contracts/ibc-reflect-send/schema/ibc/acknowledgement_msg_who_am_i.json +++ b/contracts/ibc-reflect-send/schema/ibc/acknowledgement_msg_who_am_i.json @@ -39,7 +39,8 @@ "account": { "type": "string" } - } + }, + "additionalProperties": false } } } diff --git a/contracts/ibc-reflect-send/schema/ibc/packet_msg.json b/contracts/ibc-reflect-send/schema/ibc/packet_msg.json index dc4906af5a..9b47d830f1 100644 --- a/contracts/ibc-reflect-send/schema/ibc/packet_msg.json +++ b/contracts/ibc-reflect-send/schema/ibc/packet_msg.json @@ -21,7 +21,8 @@ "$ref": "#/definitions/CosmosMsg_for_Empty" } } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -33,7 +34,8 @@ ], "properties": { "who_am_i": { - "type": "object" + "type": "object", + "additionalProperties": false } }, "additionalProperties": false @@ -45,7 +47,8 @@ ], "properties": { "balances": { - "type": "object" + "type": "object", + "additionalProperties": false } }, "additionalProperties": false @@ -78,7 +81,8 @@ "to_address": { "type": "string" } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -102,7 +106,8 @@ "$ref": "#/definitions/Coin" } } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -126,7 +131,8 @@ "denom": { "type": "string" } - } + }, + "additionalProperties": false }, "CosmosMsg_for_Empty": { "oneOf": [ @@ -262,7 +268,8 @@ "description": "The `withdraw_address`", "type": "string" } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -284,7 +291,8 @@ "description": "The `validator_address`", "type": "string" } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -293,7 +301,8 @@ }, "Empty": { "description": "An empty struct that serves as a placeholder in different places, such as contracts that don't set a custom message.\n\nIt is designed to be expressable in correct JSON and JSON Schema but contains no meaningful data. Previously we used enums without cases, but those cannot represented as valid JSON Schema (https://github.com/CosmWasm/cosmwasm/issues/451)", - "type": "object" + "type": "object", + "additionalProperties": false }, "GovMsg": { "description": "This message type allows the contract interact with the [x/gov] module in order to cast votes.\n\n[x/gov]: https://github.com/cosmos/cosmos-sdk/tree/v0.45.12/x/gov\n\n## Examples\n\nCast a simple vote:\n\n``` # use cosmwasm_std::{ # HexBinary, # Storage, Api, Querier, DepsMut, Deps, entry_point, Env, StdError, MessageInfo, # Response, QueryResponse, # }; # type ExecuteMsg = (); use cosmwasm_std::{GovMsg, VoteOption};\n\n#[entry_point] pub fn execute( deps: DepsMut, env: Env, info: MessageInfo, msg: ExecuteMsg, ) -> Result { // ... Ok(Response::new().add_message(GovMsg::Vote { proposal_id: 4, option: VoteOption::Yes, })) } ```\n\nCast a weighted vote:\n\n``` # use cosmwasm_std::{ # HexBinary, # Storage, Api, Querier, DepsMut, Deps, entry_point, Env, StdError, MessageInfo, # Response, QueryResponse, # }; # type ExecuteMsg = (); # #[cfg(feature = \"cosmwasm_1_2\")] use cosmwasm_std::{Decimal, GovMsg, VoteOption, WeightedVoteOption};\n\n# #[cfg(feature = \"cosmwasm_1_2\")] #[entry_point] pub fn execute( deps: DepsMut, env: Env, info: MessageInfo, msg: ExecuteMsg, ) -> Result { // ... Ok(Response::new().add_message(GovMsg::VoteWeighted { proposal_id: 4, options: vec![ WeightedVoteOption { option: VoteOption::Yes, weight: Decimal::percent(65), }, WeightedVoteOption { option: VoteOption::Abstain, weight: Decimal::percent(35), }, ], })) } ```", @@ -325,7 +334,8 @@ "format": "uint64", "minimum": 0.0 } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -382,7 +392,8 @@ "description": "address on the remote chain to receive these tokens", "type": "string" } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -416,7 +427,8 @@ } ] } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -437,7 +449,8 @@ "channel_id": { "type": "string" } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -468,7 +481,8 @@ } ] } - } + }, + "additionalProperties": false }, "IbcTimeoutBlock": { "description": "IBCTimeoutHeight Height is a monotonically increasing data type that can be compared against another Height for the purposes of updating and freezing clients. Ordering is (revision_number, timeout_height)", @@ -490,7 +504,8 @@ "format": "uint64", "minimum": 0.0 } - } + }, + "additionalProperties": false }, "StakingMsg": { "description": "The message types of the staking module.\n\nSee https://github.com/cosmos/cosmos-sdk/blob/v0.40.0/proto/cosmos/staking/v1beta1/tx.proto", @@ -515,7 +530,8 @@ "validator": { "type": "string" } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -540,7 +556,8 @@ "validator": { "type": "string" } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -569,7 +586,8 @@ "src_validator": { "type": "string" } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -636,7 +654,8 @@ } ] } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -686,7 +705,8 @@ } ] } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -723,7 +743,8 @@ "format": "uint64", "minimum": 0.0 } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -748,7 +769,8 @@ "contract_addr": { "type": "string" } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -769,7 +791,8 @@ "contract_addr": { "type": "string" } - } + }, + "additionalProperties": false } }, "additionalProperties": false diff --git a/contracts/ibc-reflect-send/schema/raw/execute.json b/contracts/ibc-reflect-send/schema/raw/execute.json index e846eae827..53583f78e6 100644 --- a/contracts/ibc-reflect-send/schema/raw/execute.json +++ b/contracts/ibc-reflect-send/schema/raw/execute.json @@ -129,7 +129,8 @@ "to_address": { "type": "string" } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -153,7 +154,8 @@ "$ref": "#/definitions/Coin" } } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -177,7 +179,8 @@ "denom": { "type": "string" } - } + }, + "additionalProperties": false }, "CosmosMsg_for_Empty": { "oneOf": [ @@ -313,7 +316,8 @@ "description": "The `withdraw_address`", "type": "string" } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -335,7 +339,8 @@ "description": "The `validator_address`", "type": "string" } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -344,7 +349,8 @@ }, "Empty": { "description": "An empty struct that serves as a placeholder in different places, such as contracts that don't set a custom message.\n\nIt is designed to be expressable in correct JSON and JSON Schema but contains no meaningful data. Previously we used enums without cases, but those cannot represented as valid JSON Schema (https://github.com/CosmWasm/cosmwasm/issues/451)", - "type": "object" + "type": "object", + "additionalProperties": false }, "GovMsg": { "description": "This message type allows the contract interact with the [x/gov] module in order to cast votes.\n\n[x/gov]: https://github.com/cosmos/cosmos-sdk/tree/v0.45.12/x/gov\n\n## Examples\n\nCast a simple vote:\n\n``` # use cosmwasm_std::{ # HexBinary, # Storage, Api, Querier, DepsMut, Deps, entry_point, Env, StdError, MessageInfo, # Response, QueryResponse, # }; # type ExecuteMsg = (); use cosmwasm_std::{GovMsg, VoteOption};\n\n#[entry_point] pub fn execute( deps: DepsMut, env: Env, info: MessageInfo, msg: ExecuteMsg, ) -> Result { // ... Ok(Response::new().add_message(GovMsg::Vote { proposal_id: 4, option: VoteOption::Yes, })) } ```\n\nCast a weighted vote:\n\n``` # use cosmwasm_std::{ # HexBinary, # Storage, Api, Querier, DepsMut, Deps, entry_point, Env, StdError, MessageInfo, # Response, QueryResponse, # }; # type ExecuteMsg = (); # #[cfg(feature = \"cosmwasm_1_2\")] use cosmwasm_std::{Decimal, GovMsg, VoteOption, WeightedVoteOption};\n\n# #[cfg(feature = \"cosmwasm_1_2\")] #[entry_point] pub fn execute( deps: DepsMut, env: Env, info: MessageInfo, msg: ExecuteMsg, ) -> Result { // ... Ok(Response::new().add_message(GovMsg::VoteWeighted { proposal_id: 4, options: vec![ WeightedVoteOption { option: VoteOption::Yes, weight: Decimal::percent(65), }, WeightedVoteOption { option: VoteOption::Abstain, weight: Decimal::percent(35), }, ], })) } ```", @@ -376,7 +382,8 @@ "format": "uint64", "minimum": 0.0 } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -433,7 +440,8 @@ "description": "address on the remote chain to receive these tokens", "type": "string" } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -467,7 +475,8 @@ } ] } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -488,7 +497,8 @@ "channel_id": { "type": "string" } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -519,7 +529,8 @@ } ] } - } + }, + "additionalProperties": false }, "IbcTimeoutBlock": { "description": "IBCTimeoutHeight Height is a monotonically increasing data type that can be compared against another Height for the purposes of updating and freezing clients. Ordering is (revision_number, timeout_height)", @@ -541,7 +552,8 @@ "format": "uint64", "minimum": 0.0 } - } + }, + "additionalProperties": false }, "StakingMsg": { "description": "The message types of the staking module.\n\nSee https://github.com/cosmos/cosmos-sdk/blob/v0.40.0/proto/cosmos/staking/v1beta1/tx.proto", @@ -566,7 +578,8 @@ "validator": { "type": "string" } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -591,7 +604,8 @@ "validator": { "type": "string" } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -620,7 +634,8 @@ "src_validator": { "type": "string" } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -687,7 +702,8 @@ } ] } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -737,7 +753,8 @@ } ] } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -774,7 +791,8 @@ "format": "uint64", "minimum": 0.0 } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -799,7 +817,8 @@ "contract_addr": { "type": "string" } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -820,7 +839,8 @@ "contract_addr": { "type": "string" } - } + }, + "additionalProperties": false } }, "additionalProperties": false diff --git a/contracts/ibc-reflect-send/schema/raw/response_to_account.json b/contracts/ibc-reflect-send/schema/raw/response_to_account.json index 3b022b2f57..30c737f48d 100644 --- a/contracts/ibc-reflect-send/schema/raw/response_to_account.json +++ b/contracts/ibc-reflect-send/schema/raw/response_to_account.json @@ -48,7 +48,8 @@ "denom": { "type": "string" } - } + }, + "additionalProperties": false }, "Timestamp": { "description": "A point in time in nanosecond precision.\n\nThis type can represent times from 1970-01-01T00:00:00Z to 2554-07-21T23:34:33Z.\n\n## Examples\n\n``` # use cosmwasm_std::Timestamp; let ts = Timestamp::from_nanos(1_000_000_202); assert_eq!(ts.nanos(), 1_000_000_202); assert_eq!(ts.seconds(), 1); assert_eq!(ts.subsec_nanos(), 202);\n\nlet ts = ts.plus_seconds(2); assert_eq!(ts.nanos(), 3_000_000_202); assert_eq!(ts.seconds(), 3); assert_eq!(ts.subsec_nanos(), 202); ```", diff --git a/contracts/ibc-reflect-send/schema/raw/response_to_list_accounts.json b/contracts/ibc-reflect-send/schema/raw/response_to_list_accounts.json index bb03b416b9..4c0a3c91c8 100644 --- a/contracts/ibc-reflect-send/schema/raw/response_to_list_accounts.json +++ b/contracts/ibc-reflect-send/schema/raw/response_to_list_accounts.json @@ -63,7 +63,8 @@ "denom": { "type": "string" } - } + }, + "additionalProperties": false }, "Timestamp": { "description": "A point in time in nanosecond precision.\n\nThis type can represent times from 1970-01-01T00:00:00Z to 2554-07-21T23:34:33Z.\n\n## Examples\n\n``` # use cosmwasm_std::Timestamp; let ts = Timestamp::from_nanos(1_000_000_202); assert_eq!(ts.nanos(), 1_000_000_202); assert_eq!(ts.seconds(), 1); assert_eq!(ts.subsec_nanos(), 202);\n\nlet ts = ts.plus_seconds(2); assert_eq!(ts.nanos(), 3_000_000_202); assert_eq!(ts.seconds(), 3); assert_eq!(ts.subsec_nanos(), 202); ```", diff --git a/contracts/ibc-reflect/schema/ibc-reflect.json b/contracts/ibc-reflect/schema/ibc-reflect.json index dbe9a1c1c8..7b45ee1349 100644 --- a/contracts/ibc-reflect/schema/ibc-reflect.json +++ b/contracts/ibc-reflect/schema/ibc-reflect.json @@ -66,7 +66,8 @@ "$schema": "http://json-schema.org/draft-07/schema#", "title": "MigrateMsg", "description": "An empty struct that serves as a placeholder in different places, such as contracts that don't set a custom message.\n\nIt is designed to be expressable in correct JSON and JSON Schema but contains no meaningful data. Previously we used enums without cases, but those cannot represented as valid JSON Schema (https://github.com/CosmWasm/cosmwasm/issues/451)", - "type": "object" + "type": "object", + "additionalProperties": false }, "sudo": null, "responses": { diff --git a/contracts/ibc-reflect/schema/ibc/acknowledgement_msg_balances.json b/contracts/ibc-reflect/schema/ibc/acknowledgement_msg_balances.json index b181c28559..4f6447522d 100644 --- a/contracts/ibc-reflect/schema/ibc/acknowledgement_msg_balances.json +++ b/contracts/ibc-reflect/schema/ibc/acknowledgement_msg_balances.json @@ -62,7 +62,8 @@ "denom": { "type": "string" } - } + }, + "additionalProperties": false }, "Uint128": { "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", diff --git a/contracts/ibc-reflect/schema/ibc/packet_msg.json b/contracts/ibc-reflect/schema/ibc/packet_msg.json index c1dad508a8..4712d7e5c3 100644 --- a/contracts/ibc-reflect/schema/ibc/packet_msg.json +++ b/contracts/ibc-reflect/schema/ibc/packet_msg.json @@ -126,7 +126,8 @@ "value": { "$ref": "#/definitions/Binary" } - } + }, + "additionalProperties": false }, "BankMsg": { "description": "The message types of the bank module.\n\nSee https://github.com/cosmos/cosmos-sdk/blob/v0.40.0/proto/cosmos/bank/v1beta1/tx.proto", @@ -154,7 +155,8 @@ "to_address": { "type": "string" } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -178,7 +180,8 @@ "$ref": "#/definitions/Coin" } } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -202,7 +205,8 @@ "denom": { "type": "string" } - } + }, + "additionalProperties": false }, "CosmosMsg_for_Empty": { "oneOf": [ @@ -313,7 +317,8 @@ }, "Empty": { "description": "An empty struct that serves as a placeholder in different places, such as contracts that don't set a custom message.\n\nIt is designed to be expressable in correct JSON and JSON Schema but contains no meaningful data. Previously we used enums without cases, but those cannot represented as valid JSON Schema (https://github.com/CosmWasm/cosmwasm/issues/451)", - "type": "object" + "type": "object", + "additionalProperties": false }, "GovMsg": { "description": "This message type allows the contract interact with the [x/gov] module in order to cast votes.\n\n[x/gov]: https://github.com/cosmos/cosmos-sdk/tree/v0.45.12/x/gov\n\n## Examples\n\nCast a simple vote:\n\n``` # use cosmwasm_std::{ # HexBinary, # Storage, Api, Querier, DepsMut, Deps, entry_point, Env, StdError, MessageInfo, # Response, QueryResponse, # }; # type ExecuteMsg = (); use cosmwasm_std::{GovMsg, VoteOption};\n\n#[entry_point] pub fn execute( deps: DepsMut, env: Env, info: MessageInfo, msg: ExecuteMsg, ) -> Result { // ... Ok(Response::new().add_message(GovMsg::Vote { proposal_id: 4, option: VoteOption::Yes, })) } ```\n\nCast a weighted vote:\n\n``` # use cosmwasm_std::{ # HexBinary, # Storage, Api, Querier, DepsMut, Deps, entry_point, Env, StdError, MessageInfo, # Response, QueryResponse, # }; # type ExecuteMsg = (); # #[cfg(feature = \"cosmwasm_1_2\")] use cosmwasm_std::{Decimal, GovMsg, VoteOption, WeightedVoteOption};\n\n# #[cfg(feature = \"cosmwasm_1_2\")] #[entry_point] pub fn execute( deps: DepsMut, env: Env, info: MessageInfo, msg: ExecuteMsg, ) -> Result { // ... Ok(Response::new().add_message(GovMsg::VoteWeighted { proposal_id: 4, options: vec![ WeightedVoteOption { option: VoteOption::Yes, weight: Decimal::percent(65), }, WeightedVoteOption { option: VoteOption::Abstain, weight: Decimal::percent(35), }, ], })) } ```", @@ -345,7 +350,8 @@ "format": "uint64", "minimum": 0.0 } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -375,7 +381,8 @@ "format": "uint64", "minimum": 0.0 } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -432,7 +439,8 @@ "description": "address on the remote chain to receive these tokens", "type": "string" } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -466,7 +474,8 @@ } ] } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -487,7 +496,8 @@ "channel_id": { "type": "string" } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -518,7 +528,8 @@ } ] } - } + }, + "additionalProperties": false }, "IbcTimeoutBlock": { "description": "IBCTimeoutHeight Height is a monotonically increasing data type that can be compared against another Height for the purposes of updating and freezing clients. Ordering is (revision_number, timeout_height)", @@ -540,7 +551,8 @@ "format": "uint64", "minimum": 0.0 } - } + }, + "additionalProperties": false }, "Timestamp": { "description": "A point in time in nanosecond precision.\n\nThis type can represent times from 1970-01-01T00:00:00Z to 2554-07-21T23:34:33Z.\n\n## Examples\n\n``` # use cosmwasm_std::Timestamp; let ts = Timestamp::from_nanos(1_000_000_202); assert_eq!(ts.nanos(), 1_000_000_202); assert_eq!(ts.seconds(), 1); assert_eq!(ts.subsec_nanos(), 202);\n\nlet ts = ts.plus_seconds(2); assert_eq!(ts.nanos(), 3_000_000_202); assert_eq!(ts.seconds(), 3); assert_eq!(ts.subsec_nanos(), 202); ```", @@ -602,7 +614,8 @@ } ] } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -652,7 +665,8 @@ } ] } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -706,7 +720,8 @@ "salt": { "$ref": "#/definitions/Binary" } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -743,7 +758,8 @@ "format": "uint64", "minimum": 0.0 } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -768,7 +784,8 @@ "contract_addr": { "type": "string" } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -789,7 +806,8 @@ "contract_addr": { "type": "string" } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -809,7 +827,8 @@ "weight": { "$ref": "#/definitions/Decimal" } - } + }, + "additionalProperties": false } } } diff --git a/contracts/ibc-reflect/schema/raw/migrate.json b/contracts/ibc-reflect/schema/raw/migrate.json index 2bba958247..528735ee4e 100644 --- a/contracts/ibc-reflect/schema/raw/migrate.json +++ b/contracts/ibc-reflect/schema/raw/migrate.json @@ -2,5 +2,6 @@ "$schema": "http://json-schema.org/draft-07/schema#", "title": "MigrateMsg", "description": "An empty struct that serves as a placeholder in different places, such as contracts that don't set a custom message.\n\nIt is designed to be expressable in correct JSON and JSON Schema but contains no meaningful data. Previously we used enums without cases, but those cannot represented as valid JSON Schema (https://github.com/CosmWasm/cosmwasm/issues/451)", - "type": "object" + "type": "object", + "additionalProperties": false } diff --git a/contracts/queue/schema/queue.json b/contracts/queue/schema/queue.json index f46c4f00e1..49503f826a 100644 --- a/contracts/queue/schema/queue.json +++ b/contracts/queue/schema/queue.json @@ -199,7 +199,8 @@ "$schema": "http://json-schema.org/draft-07/schema#", "title": "Empty", "description": "An empty struct that serves as a placeholder in different places, such as contracts that don't set a custom message.\n\nIt is designed to be expressable in correct JSON and JSON Schema but contains no meaningful data. Previously we used enums without cases, but those cannot represented as valid JSON Schema (https://github.com/CosmWasm/cosmwasm/issues/451)", - "type": "object" + "type": "object", + "additionalProperties": false }, "reducer": { "$schema": "http://json-schema.org/draft-07/schema#", diff --git a/contracts/queue/schema/raw/response_to_open_iterators.json b/contracts/queue/schema/raw/response_to_open_iterators.json index ad4ff226d4..d0d159572d 100644 --- a/contracts/queue/schema/raw/response_to_open_iterators.json +++ b/contracts/queue/schema/raw/response_to_open_iterators.json @@ -2,5 +2,6 @@ "$schema": "http://json-schema.org/draft-07/schema#", "title": "Empty", "description": "An empty struct that serves as a placeholder in different places, such as contracts that don't set a custom message.\n\nIt is designed to be expressable in correct JSON and JSON Schema but contains no meaningful data. Previously we used enums without cases, but those cannot represented as valid JSON Schema (https://github.com/CosmWasm/cosmwasm/issues/451)", - "type": "object" + "type": "object", + "additionalProperties": false } diff --git a/contracts/reflect/schema/raw/execute.json b/contracts/reflect/schema/raw/execute.json index 766cf49a16..64ea55fc8d 100644 --- a/contracts/reflect/schema/raw/execute.json +++ b/contracts/reflect/schema/raw/execute.json @@ -87,7 +87,8 @@ "value": { "$ref": "#/definitions/Binary" } - } + }, + "additionalProperties": false }, "BankMsg": { "description": "The message types of the bank module.\n\nSee https://github.com/cosmos/cosmos-sdk/blob/v0.40.0/proto/cosmos/bank/v1beta1/tx.proto", @@ -115,7 +116,8 @@ "to_address": { "type": "string" } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -139,7 +141,8 @@ "$ref": "#/definitions/Coin" } } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -163,7 +166,8 @@ "denom": { "type": "string" } - } + }, + "additionalProperties": false }, "CosmosMsg_for_CustomMsg": { "oneOf": [ @@ -345,7 +349,8 @@ "description": "The `withdraw_address`", "type": "string" } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -367,7 +372,8 @@ "description": "The `validator_address`", "type": "string" } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -392,7 +398,8 @@ "$ref": "#/definitions/Coin" } } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -429,7 +436,8 @@ "format": "uint64", "minimum": 0.0 } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -459,7 +467,8 @@ "format": "uint64", "minimum": 0.0 } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -516,7 +525,8 @@ "description": "address on the remote chain to receive these tokens", "type": "string" } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -550,7 +560,8 @@ } ] } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -571,7 +582,8 @@ "channel_id": { "type": "string" } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -602,7 +614,8 @@ } ] } - } + }, + "additionalProperties": false }, "IbcTimeoutBlock": { "description": "IBCTimeoutHeight Height is a monotonically increasing data type that can be compared against another Height for the purposes of updating and freezing clients. Ordering is (revision_number, timeout_height)", @@ -624,7 +637,8 @@ "format": "uint64", "minimum": 0.0 } - } + }, + "additionalProperties": false }, "ReplyOn": { "description": "Use this to define when the contract gets a response callback. If you only need it for errors or success you can select just those in order to save gas.", @@ -682,7 +696,8 @@ "validator": { "type": "string" } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -707,7 +722,8 @@ "validator": { "type": "string" } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -736,7 +752,8 @@ "src_validator": { "type": "string" } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -782,7 +799,8 @@ "reply_on": { "$ref": "#/definitions/ReplyOn" } - } + }, + "additionalProperties": false }, "Timestamp": { "description": "A point in time in nanosecond precision.\n\nThis type can represent times from 1970-01-01T00:00:00Z to 2554-07-21T23:34:33Z.\n\n## Examples\n\n``` # use cosmwasm_std::Timestamp; let ts = Timestamp::from_nanos(1_000_000_202); assert_eq!(ts.nanos(), 1_000_000_202); assert_eq!(ts.seconds(), 1); assert_eq!(ts.subsec_nanos(), 202);\n\nlet ts = ts.plus_seconds(2); assert_eq!(ts.nanos(), 3_000_000_202); assert_eq!(ts.seconds(), 3); assert_eq!(ts.subsec_nanos(), 202); ```", @@ -844,7 +862,8 @@ } ] } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -894,7 +913,8 @@ } ] } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -948,7 +968,8 @@ "salt": { "$ref": "#/definitions/Binary" } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -985,7 +1006,8 @@ "format": "uint64", "minimum": 0.0 } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -1010,7 +1032,8 @@ "contract_addr": { "type": "string" } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -1031,7 +1054,8 @@ "contract_addr": { "type": "string" } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -1051,7 +1075,8 @@ "weight": { "$ref": "#/definitions/Decimal" } - } + }, + "additionalProperties": false } } } diff --git a/contracts/reflect/schema/raw/query.json b/contracts/reflect/schema/raw/query.json index 4191afab52..deb85fae20 100644 --- a/contracts/reflect/schema/raw/query.json +++ b/contracts/reflect/schema/raw/query.json @@ -129,7 +129,8 @@ "denom": { "type": "string" } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -154,7 +155,8 @@ "denom": { "type": "string" } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -175,7 +177,8 @@ "address": { "type": "string" } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -196,7 +199,8 @@ "denom": { "type": "string" } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -221,7 +225,8 @@ } ] } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -250,7 +255,8 @@ "delegator_address": { "type": "string" } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -275,7 +281,8 @@ "validator_address": { "type": "string" } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -296,7 +303,8 @@ "delegator_address": { "type": "string" } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -317,7 +325,8 @@ "delegator_address": { "type": "string" } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -344,7 +353,8 @@ "description": "The fully qualified endpoint path used for routing. It follows the format `/service_path/method_name`, eg. \"/cosmos.authz.v1beta1.Query/Grants\"", "type": "string" } - } + }, + "additionalProperties": false }, "IbcQuery": { "description": "These are queries to the various IBC modules to see the state of the contract's IBC connection. These will return errors if the contract is not \"ibc enabled\"", @@ -357,7 +367,8 @@ ], "properties": { "port_id": { - "type": "object" + "type": "object", + "additionalProperties": false } }, "additionalProperties": false @@ -378,7 +389,8 @@ "null" ] } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -405,7 +417,8 @@ "null" ] } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -438,7 +451,8 @@ "reverse": { "type": "boolean" } - } + }, + "additionalProperties": false }, "QueryRequest_for_SpecialQuery": { "oneOf": [ @@ -517,7 +531,8 @@ "description": "this is the fully qualified service path used for routing, eg. \"/cosmos_sdk.x.bank.v1.Query/QueryBalance\"", "type": "string" } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -609,7 +624,8 @@ ], "properties": { "bonded_denom": { - "type": "object" + "type": "object", + "additionalProperties": false } }, "additionalProperties": false @@ -630,7 +646,8 @@ "delegator": { "type": "string" } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -655,7 +672,8 @@ "validator": { "type": "string" } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -668,7 +686,8 @@ ], "properties": { "all_validators": { - "type": "object" + "type": "object", + "additionalProperties": false } }, "additionalProperties": false @@ -690,7 +709,8 @@ "description": "The validator's address (e.g. (e.g. cosmosvaloper1...))", "type": "string" } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -724,7 +744,8 @@ } ] } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -754,7 +775,8 @@ } ] } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -775,7 +797,8 @@ "contract_addr": { "type": "string" } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -798,7 +821,8 @@ "format": "uint64", "minimum": 0.0 } - } + }, + "additionalProperties": false } }, "additionalProperties": false diff --git a/contracts/reflect/schema/raw/response_to_sub_msg_result.json b/contracts/reflect/schema/raw/response_to_sub_msg_result.json index f0217bf3bc..f6c05147e3 100644 --- a/contracts/reflect/schema/raw/response_to_sub_msg_result.json +++ b/contracts/reflect/schema/raw/response_to_sub_msg_result.json @@ -34,6 +34,7 @@ "$ref": "#/definitions/SubMsgResult" } }, + "additionalProperties": false, "definitions": { "Attribute": { "description": "An key value pair that is used in the context of event attributes in logs", @@ -49,7 +50,8 @@ "value": { "type": "string" } - } + }, + "additionalProperties": false }, "Binary": { "description": "Binary is a wrapper around Vec to add base64 de/serialization with serde. It also adds some helper methods to help encode inline.\n\nThis is only needed as serde-json-{core,wasm} has a horrible encoding for Vec. See also .", @@ -74,7 +76,8 @@ "description": "The event type. This is renamed to \"ty\" because \"type\" is reserved in Rust. This sucks, we know.", "type": "string" } - } + }, + "additionalProperties": false }, "MsgResponse": { "type": "object", @@ -89,7 +92,8 @@ "value": { "$ref": "#/definitions/Binary" } - } + }, + "additionalProperties": false }, "SubMsgResponse": { "description": "The information we get back from a successful sub message execution, with full Cosmos SDK events.", @@ -123,7 +127,8 @@ "$ref": "#/definitions/MsgResponse" } } - } + }, + "additionalProperties": false }, "SubMsgResult": { "description": "This is the result type that is returned from a sub message execution.\n\nWe use a custom type here instead of Rust's Result because we want to be able to define the serialization, which is a public interface. Every language that compiles to Wasm and runs in the ComsWasm VM needs to create the same JSON representation.\n\nUntil version 1.0.0-beta5, `ContractResult` was used instead of this type. Once serialized, the two types are the same. However, in the Rust type system we want different types for clarity and documenation reasons.\n\n# Examples\n\nSuccess:\n\n``` # use cosmwasm_std::{to_json_string, Binary, Event, SubMsgResponse, SubMsgResult}; #[allow(deprecated)] let response = SubMsgResponse { data: Some(Binary::from_base64(\"MTIzCg==\").unwrap()), events: vec![Event::new(\"wasm\").add_attribute(\"fo\", \"ba\")], msg_responses: vec![], }; let result: SubMsgResult = SubMsgResult::Ok(response); assert_eq!( to_json_string(&result).unwrap(), r#\"{\"ok\":{\"events\":[{\"type\":\"wasm\",\"attributes\":[{\"key\":\"fo\",\"value\":\"ba\"}]}],\"data\":\"MTIzCg==\",\"msg_responses\":[]}}\"#, ); ```\n\nFailure:\n\n``` # use cosmwasm_std::{to_json_string, SubMsgResult, Response}; let error_msg = String::from(\"Something went wrong\"); let result = SubMsgResult::Err(error_msg); assert_eq!(to_json_string(&result).unwrap(), r#\"{\"error\":\"Something went wrong\"}\"#); ```", diff --git a/contracts/reflect/schema/reflect.json b/contracts/reflect/schema/reflect.json index 3cddd7b911..1cd86532e5 100644 --- a/contracts/reflect/schema/reflect.json +++ b/contracts/reflect/schema/reflect.json @@ -97,7 +97,8 @@ "value": { "$ref": "#/definitions/Binary" } - } + }, + "additionalProperties": false }, "BankMsg": { "description": "The message types of the bank module.\n\nSee https://github.com/cosmos/cosmos-sdk/blob/v0.40.0/proto/cosmos/bank/v1beta1/tx.proto", @@ -125,7 +126,8 @@ "to_address": { "type": "string" } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -149,7 +151,8 @@ "$ref": "#/definitions/Coin" } } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -173,7 +176,8 @@ "denom": { "type": "string" } - } + }, + "additionalProperties": false }, "CosmosMsg_for_CustomMsg": { "oneOf": [ @@ -355,7 +359,8 @@ "description": "The `withdraw_address`", "type": "string" } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -377,7 +382,8 @@ "description": "The `validator_address`", "type": "string" } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -402,7 +408,8 @@ "$ref": "#/definitions/Coin" } } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -439,7 +446,8 @@ "format": "uint64", "minimum": 0.0 } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -469,7 +477,8 @@ "format": "uint64", "minimum": 0.0 } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -526,7 +535,8 @@ "description": "address on the remote chain to receive these tokens", "type": "string" } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -560,7 +570,8 @@ } ] } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -581,7 +592,8 @@ "channel_id": { "type": "string" } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -612,7 +624,8 @@ } ] } - } + }, + "additionalProperties": false }, "IbcTimeoutBlock": { "description": "IBCTimeoutHeight Height is a monotonically increasing data type that can be compared against another Height for the purposes of updating and freezing clients. Ordering is (revision_number, timeout_height)", @@ -634,7 +647,8 @@ "format": "uint64", "minimum": 0.0 } - } + }, + "additionalProperties": false }, "ReplyOn": { "description": "Use this to define when the contract gets a response callback. If you only need it for errors or success you can select just those in order to save gas.", @@ -692,7 +706,8 @@ "validator": { "type": "string" } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -717,7 +732,8 @@ "validator": { "type": "string" } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -746,7 +762,8 @@ "src_validator": { "type": "string" } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -792,7 +809,8 @@ "reply_on": { "$ref": "#/definitions/ReplyOn" } - } + }, + "additionalProperties": false }, "Timestamp": { "description": "A point in time in nanosecond precision.\n\nThis type can represent times from 1970-01-01T00:00:00Z to 2554-07-21T23:34:33Z.\n\n## Examples\n\n``` # use cosmwasm_std::Timestamp; let ts = Timestamp::from_nanos(1_000_000_202); assert_eq!(ts.nanos(), 1_000_000_202); assert_eq!(ts.seconds(), 1); assert_eq!(ts.subsec_nanos(), 202);\n\nlet ts = ts.plus_seconds(2); assert_eq!(ts.nanos(), 3_000_000_202); assert_eq!(ts.seconds(), 3); assert_eq!(ts.subsec_nanos(), 202); ```", @@ -854,7 +872,8 @@ } ] } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -904,7 +923,8 @@ } ] } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -958,7 +978,8 @@ "salt": { "$ref": "#/definitions/Binary" } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -995,7 +1016,8 @@ "format": "uint64", "minimum": 0.0 } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -1020,7 +1042,8 @@ "contract_addr": { "type": "string" } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -1041,7 +1064,8 @@ "contract_addr": { "type": "string" } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -1061,7 +1085,8 @@ "weight": { "$ref": "#/definitions/Decimal" } - } + }, + "additionalProperties": false } } }, @@ -1196,7 +1221,8 @@ "denom": { "type": "string" } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -1221,7 +1247,8 @@ "denom": { "type": "string" } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -1242,7 +1269,8 @@ "address": { "type": "string" } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -1263,7 +1291,8 @@ "denom": { "type": "string" } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -1288,7 +1317,8 @@ } ] } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -1317,7 +1347,8 @@ "delegator_address": { "type": "string" } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -1342,7 +1373,8 @@ "validator_address": { "type": "string" } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -1363,7 +1395,8 @@ "delegator_address": { "type": "string" } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -1384,7 +1417,8 @@ "delegator_address": { "type": "string" } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -1411,7 +1445,8 @@ "description": "The fully qualified endpoint path used for routing. It follows the format `/service_path/method_name`, eg. \"/cosmos.authz.v1beta1.Query/Grants\"", "type": "string" } - } + }, + "additionalProperties": false }, "IbcQuery": { "description": "These are queries to the various IBC modules to see the state of the contract's IBC connection. These will return errors if the contract is not \"ibc enabled\"", @@ -1424,7 +1459,8 @@ ], "properties": { "port_id": { - "type": "object" + "type": "object", + "additionalProperties": false } }, "additionalProperties": false @@ -1445,7 +1481,8 @@ "null" ] } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -1472,7 +1509,8 @@ "null" ] } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -1505,7 +1543,8 @@ "reverse": { "type": "boolean" } - } + }, + "additionalProperties": false }, "QueryRequest_for_SpecialQuery": { "oneOf": [ @@ -1584,7 +1623,8 @@ "description": "this is the fully qualified service path used for routing, eg. \"/cosmos_sdk.x.bank.v1.Query/QueryBalance\"", "type": "string" } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -1676,7 +1716,8 @@ ], "properties": { "bonded_denom": { - "type": "object" + "type": "object", + "additionalProperties": false } }, "additionalProperties": false @@ -1697,7 +1738,8 @@ "delegator": { "type": "string" } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -1722,7 +1764,8 @@ "validator": { "type": "string" } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -1735,7 +1778,8 @@ ], "properties": { "all_validators": { - "type": "object" + "type": "object", + "additionalProperties": false } }, "additionalProperties": false @@ -1757,7 +1801,8 @@ "description": "The validator's address (e.g. (e.g. cosmosvaloper1...))", "type": "string" } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -1791,7 +1836,8 @@ } ] } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -1821,7 +1867,8 @@ } ] } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -1842,7 +1889,8 @@ "contract_addr": { "type": "string" } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -1865,7 +1913,8 @@ "format": "uint64", "minimum": 0.0 } - } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -1986,6 +2035,7 @@ "$ref": "#/definitions/SubMsgResult" } }, + "additionalProperties": false, "definitions": { "Attribute": { "description": "An key value pair that is used in the context of event attributes in logs", @@ -2001,7 +2051,8 @@ "value": { "type": "string" } - } + }, + "additionalProperties": false }, "Binary": { "description": "Binary is a wrapper around Vec to add base64 de/serialization with serde. It also adds some helper methods to help encode inline.\n\nThis is only needed as serde-json-{core,wasm} has a horrible encoding for Vec. See also .", @@ -2026,7 +2077,8 @@ "description": "The event type. This is renamed to \"ty\" because \"type\" is reserved in Rust. This sucks, we know.", "type": "string" } - } + }, + "additionalProperties": false }, "MsgResponse": { "type": "object", @@ -2041,7 +2093,8 @@ "value": { "$ref": "#/definitions/Binary" } - } + }, + "additionalProperties": false }, "SubMsgResponse": { "description": "The information we get back from a successful sub message execution, with full Cosmos SDK events.", @@ -2075,7 +2128,8 @@ "$ref": "#/definitions/MsgResponse" } } - } + }, + "additionalProperties": false }, "SubMsgResult": { "description": "This is the result type that is returned from a sub message execution.\n\nWe use a custom type here instead of Rust's Result because we want to be able to define the serialization, which is a public interface. Every language that compiles to Wasm and runs in the ComsWasm VM needs to create the same JSON representation.\n\nUntil version 1.0.0-beta5, `ContractResult` was used instead of this type. Once serialized, the two types are the same. However, in the Rust type system we want different types for clarity and documenation reasons.\n\n# Examples\n\nSuccess:\n\n``` # use cosmwasm_std::{to_json_string, Binary, Event, SubMsgResponse, SubMsgResult}; #[allow(deprecated)] let response = SubMsgResponse { data: Some(Binary::from_base64(\"MTIzCg==\").unwrap()), events: vec![Event::new(\"wasm\").add_attribute(\"fo\", \"ba\")], msg_responses: vec![], }; let result: SubMsgResult = SubMsgResult::Ok(response); assert_eq!( to_json_string(&result).unwrap(), r#\"{\"ok\":{\"events\":[{\"type\":\"wasm\",\"attributes\":[{\"key\":\"fo\",\"value\":\"ba\"}]}],\"data\":\"MTIzCg==\",\"msg_responses\":[]}}\"#, ); ```\n\nFailure:\n\n``` # use cosmwasm_std::{to_json_string, SubMsgResult, Response}; let error_msg = String::from(\"Something went wrong\"); let result = SubMsgResult::Err(error_msg); assert_eq!(to_json_string(&result).unwrap(), r#\"{\"error\":\"Something went wrong\"}\"#); ```", diff --git a/contracts/staking/schema/raw/response_to_investment.json b/contracts/staking/schema/raw/response_to_investment.json index ffa5b81226..23fd138114 100644 --- a/contracts/staking/schema/raw/response_to_investment.json +++ b/contracts/staking/schema/raw/response_to_investment.json @@ -61,7 +61,8 @@ "denom": { "type": "string" } - } + }, + "additionalProperties": false }, "Decimal": { "description": "A fixed-point decimal value with 18 fractional digits, i.e. Decimal(1_000_000_000_000_000_000) == 1.0\n\nThe greatest possible value that can be represented is 340282366920938463463.374607431768211455 (which is (2^128 - 1) / 10^18)", diff --git a/contracts/staking/schema/staking.json b/contracts/staking/schema/staking.json index 3f395ac414..e5e3f98843 100644 --- a/contracts/staking/schema/staking.json +++ b/contracts/staking/schema/staking.json @@ -362,7 +362,8 @@ "denom": { "type": "string" } - } + }, + "additionalProperties": false }, "Decimal": { "description": "A fixed-point decimal value with 18 fractional digits, i.e. Decimal(1_000_000_000_000_000_000) == 1.0\n\nThe greatest possible value that can be represented is 340282366920938463463.374607431768211455 (which is (2^128 - 1) / 10^18)", diff --git a/packages/schema-derive/src/cw_serde.rs b/packages/schema-derive/src/cw_serde.rs index 7267935aed..be35fd3415 100644 --- a/packages/schema-derive/src/cw_serde.rs +++ b/packages/schema-derive/src/cw_serde.rs @@ -52,7 +52,7 @@ pub fn cw_serde_impl(options: Options, input: DeriveInput) -> syn::Result { - $crate::schemars::gen::SchemaGenerator::new($crate::schemars::gen::SchemaSettings::draft07()).into_root_schema_for::<$type>() - }; + ($type:ty) => {{ + let mut schema = $crate::schemars::gen::SchemaGenerator::new( + $crate::schemars::gen::SchemaSettings::draft07(), + ) + .into_root_schema_for::<$type>(); + + struct Visitor; + impl $crate::schemars::visit::Visitor for Visitor { + fn visit_schema_object(&mut self, schema: &mut $crate::schemars::schema::SchemaObject) { + $crate::schemars::visit::visit_schema_object(self, schema); + + if let Some(ref mut validation) = schema.object { + validation.additional_properties = Some(Box::new(false.into())); + } + } + } + + $crate::schemars::visit::visit_root_schema(&mut Visitor, &mut schema); + + schema + }}; ($_:expr) => { compile_error!("The argument to `schema_for!` is not a type.") }; diff --git a/packages/schema/tests/idl.rs b/packages/schema/tests/idl.rs index 2e8ffca3b9..f728313a8b 100644 --- a/packages/schema/tests/idl.rs +++ b/packages/schema/tests/idl.rs @@ -32,6 +32,20 @@ pub struct MigrateMsg { pub cap: u128, } +#[test] +fn unknown_fields_explicity_allowed() { + let json = serde_json::json!({ + "admin": "someone", + "cap": 512, + "UNKNOWN_FIELD_DONT_PANIC": "I MEAN IT" + }); + let json_str = serde_json::to_string(&json).unwrap(); + let migrate_msg: MigrateMsg = serde_json::from_str(&json_str).unwrap(); + + assert_eq!(migrate_msg.admin, "someone"); + assert_eq!(migrate_msg.cap, 512); +} + #[test] fn test_basic_structure() { let api_str = generate_api! {