Skip to content

Commit 2520db2

Browse files
committed
fix(test): build rmcp AuthorizationMetadata via deserialize, not struct literal
The resource-param test came in from main's side of the merge, where rmcp v0.17 allowed a struct literal. On this branch (rmcp v1.5) AuthorizationMetadata is #[non_exhaustive], so it can't be constructed with a struct expression from outside the crate. Deserialize from JSON instead — also avoids clippy's field_reassign_with_default lint that the mutate-from-default pattern would trip. Signed-off-by: Mohammod Al Amin Ashik <maa.ashik00@gmail.com>
1 parent db54d13 commit 2520db2

1 file changed

Lines changed: 10 additions & 7 deletions

File tree

crates/mcpmux-gateway/src/pool/oauth.rs

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1673,13 +1673,16 @@ mod resource_param_tests {
16731673
.await
16741674
.expect("construct AuthorizationManager");
16751675

1676-
manager.set_metadata(AuthorizationMetadata {
1677-
authorization_endpoint: "https://auth.example.test/authorize".to_string(),
1678-
token_endpoint: "https://auth.example.test/token".to_string(),
1679-
response_types_supported: Some(vec!["code".to_string()]),
1680-
code_challenge_methods_supported: Some(vec!["S256".to_string()]),
1681-
..Default::default()
1682-
});
1676+
// `AuthorizationMetadata` is `#[non_exhaustive]` in rmcp 1.5, so it can't be
1677+
// built with a struct literal from outside the crate. Deserialize it instead.
1678+
let metadata: AuthorizationMetadata = serde_json::from_value(serde_json::json!({
1679+
"authorization_endpoint": "https://auth.example.test/authorize",
1680+
"token_endpoint": "https://auth.example.test/token",
1681+
"response_types_supported": ["code"],
1682+
"code_challenge_methods_supported": ["S256"],
1683+
}))
1684+
.expect("build AuthorizationMetadata");
1685+
manager.set_metadata(metadata);
16831686
manager
16841687
.configure_client_id("test-client")
16851688
.expect("configure client id");

0 commit comments

Comments
 (0)