amogh-jahagirdar commented on code in PR #2692:
URL: https://github.com/apache/iceberg-rust/pull/2692#discussion_r3487116172
##########
crates/catalog/rest/src/catalog.rs:
##########
@@ -412,14 +417,41 @@ impl RestCatalog {
.get_or_try_init(|| async {
let client = HttpClient::new(&self.user_config)?;
let catalog_config = RestCatalog::load_config(&client,
&self.user_config).await?;
+ // The `endpoints` field is optional. An absent field (`None`)
+ // means an older server, so fall back to the standard base
set;
+ // an explicit list — even an empty one — is taken verbatim.
+ let endpoints = match &catalog_config.endpoints {
+ Some(advertised) => advertised.iter().cloned().collect(),
+ None => crate::endpoint::DEFAULT_ENDPOINTS.clone(),
+ };
let config =
self.user_config.clone().merge_with_config(catalog_config);
let client = client.update_with(&config)?;
- Ok(RestContext { config, client })
+ Ok(RestContext {
+ config,
+ client,
+ endpoints,
+ })
})
.await
}
+ /// Returns whether the connected server supports `endpoint`.
+ ///
+ /// Servers advertise the routes they support in the `endpoints` field of
+ /// the `GET /v1/config` response. When that field is present it is used
+ /// verbatim (an explicit empty list therefore advertises nothing). When a
Review Comment:
The reason for the fallback in the explicit empty case is that I'm largely
looking at it as more likely that there are buggy servers out there that return
empty lists even though they don't intend to, rather than servers that want to
advertise "Hey i don't support anything".
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]