Closed dzmitry-lahoda closed 7 months ago
based on these types https://github.com/ComposableFi/composable-vm/blob/main/schema/cvm-runtime.json
found root cause
#[allow(clippy::large_enum_variant)]
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "snake_case")]
#[cfg_attr(
all(
feature = "json-schema", // all(feature = "json-schema", not(target_arch = "wasm32")),
not(feature = "xcm")
),
derive(schemars::JsonSchema)
)]
pub enum ForeignAssetId {
IbcIcs20(PrefixedDenom),
// `xcm::VersionedMultiLocation` not validated, until XCM supports std wasm or CW no_std (or copy paste)
Xcm(serde_cw_value::Value),
}
so it cannot type object with type JSON
(in rust it is serde_cw_value::Value)
replaced with binary for now (XCM serde is SCALE).
observation that python model generator from schema fails on same JSON schema.
either shemars are buggy, or serde_cw_value gives buggy schema, or ts/py generators have bug, or have serde_cw_value as type in schema is useless
so does it work now? sounds like a Rust issue?
Can you provide a schema?
so does it work now? sounds like a Rust issue?
@pyramation I does not look like exactly Rust issue. Let me explain.
I have cosmwasm contract with kind of valid JSON schema. I generate json file with schema out of it.
But ts generator fails to generate typescript code.
As soon as it can be agreed that JSON schema here is valid https://github.com/ComposableFi/composable-vm/blob/c38dd934eff95f5ca73faa5e1a77bd785a6f1562/schema/cvm-runtime.json#L950 , ts gen should not fail.
ahaha. right https://github.com/ComposableFi/composable-vm/blob/c38dd934eff95f5ca73faa5e1a77bd785a6f1562/schema/cvm-runtime.json#L2250 . it is not valid. fun
I did not had bug, just got it now (tried old and latest version of generator):
I updated version of CW from 1.2.X to 1.5.X. Also added some more msgs into contract.