Skip to content

Commit

Permalink
Revert "[json-rpc] Update variants to be returned in declaration orde…
Browse files Browse the repository at this point in the history
…r" (#21413) (#21414)

Reverts #21359

The change in the format is causing breaking issues for clients. Revert
back to previous layout for now.
  • Loading branch information
tzakian authored Mar 4, 2025
1 parent e019769 commit 556b6e1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 18 deletions.
5 changes: 2 additions & 3 deletions crates/sui-json-rpc-types/src/sui_move.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,7 @@ pub struct SuiMoveNormalizedStruct {
pub struct SuiMoveNormalizedEnum {
pub abilities: SuiMoveAbilitySet,
pub type_parameters: Vec<SuiMoveStructTypeParameter>,
// NB: Don't use a `BTreeMap` here as we want to keep the declaration order of the variants
pub variants: Vec<(String, Vec<SuiMoveNormalizedField>)>,
pub variants: BTreeMap<String, Vec<SuiMoveNormalizedField>>,
}

#[derive(Serialize, Deserialize, Debug, JsonSchema, Clone)]
Expand Down Expand Up @@ -247,7 +246,7 @@ impl From<NormalizedEnum> for SuiMoveNormalizedEnum {
.collect::<Vec<SuiMoveNormalizedField>>(),
)
})
.collect::<Vec<(String, Vec<SuiMoveNormalizedField>)>>(),
.collect::<BTreeMap<String, Vec<SuiMoveNormalizedField>>>(),
}
}
}
Expand Down
20 changes: 5 additions & 15 deletions crates/sui-open-rpc/spec/openrpc.json
Original file line number Diff line number Diff line change
Expand Up @@ -9009,22 +9009,12 @@
}
},
"variants": {
"type": "array",
"items": {
"type": "object",
"additionalProperties": {
"type": "array",
"items": [
{
"type": "string"
},
{
"type": "array",
"items": {
"$ref": "#/components/schemas/SuiMoveNormalizedField"
}
}
],
"maxItems": 2,
"minItems": 2
"items": {
"$ref": "#/components/schemas/SuiMoveNormalizedField"
}
}
}
}
Expand Down

0 comments on commit 556b6e1

Please sign in to comment.