diff --git a/crates/ruma-appservice-api/CHANGELOG.md b/crates/ruma-appservice-api/CHANGELOG.md index 6770dbbe..0addc5d9 100644 --- a/crates/ruma-appservice-api/CHANGELOG.md +++ b/crates/ruma-appservice-api/CHANGELOG.md @@ -1,5 +1,10 @@ # [unreleased] +Breaking changes: + +* The `url` field of `Registration` is now an `Option`. This should have + always been the case. + # 0.9.0 Improvements: diff --git a/crates/ruma-appservice-api/src/lib.rs b/crates/ruma-appservice-api/src/lib.rs index f6f74d11..25af421d 100644 --- a/crates/ruma-appservice-api/src/lib.rs +++ b/crates/ruma-appservice-api/src/lib.rs @@ -74,7 +74,9 @@ pub struct Registration { pub id: String, /// The URL for the application service. - pub url: String, + /// + /// Optionally set to `null` if no traffic is required. + pub url: Option, /// A unique token for application services to use to authenticate requests to Homeservers. pub as_token: String, @@ -112,7 +114,9 @@ pub struct RegistrationInit { pub id: String, /// The URL for the application service. - pub url: String, + /// + /// Optionally set to `null` if no traffic is required. + pub url: Option, /// A unique token for application services to use to authenticate requests to Homeservers. pub as_token: String, diff --git a/crates/ruma-appservice-api/tests/appservice_registration.rs b/crates/ruma-appservice-api/tests/appservice_registration.rs index 38dfd3f2..6499bada 100644 --- a/crates/ruma-appservice-api/tests/appservice_registration.rs +++ b/crates/ruma-appservice-api/tests/appservice_registration.rs @@ -21,7 +21,7 @@ fn registration_deserialization() { let observed: Registration = serde_yaml::from_str(registration_config).unwrap(); assert_eq!(observed.id, "IRC Bridge"); - assert_eq!(observed.url, "http://127.0.0.1:1234"); + assert_eq!(observed.url.unwrap(), "http://127.0.0.1:1234"); assert_eq!( observed.as_token, "30c05ae90a248a4188e620216fa72e349803310ec83e2a77b34fe90be6081f46" @@ -59,5 +59,5 @@ fn config_with_optional_url() { rooms: [] "#; assert_matches!(serde_yaml::from_str(registration_config).unwrap(), Registration { url, .. }); - assert_eq!(url, "null"); + assert_eq!(url, None); }