diff --git a/jsonschema/src/resolver.rs b/jsonschema/src/resolver.rs index 091b1c34..5c5f3363 100644 --- a/jsonschema/src/resolver.rs +++ b/jsonschema/src/resolver.rs @@ -76,18 +76,22 @@ impl SchemaResolver for DefaultResolver { ) -> Result, SchemaResolverError> { match url.scheme() { "http" | "https" => { - #[cfg(all(feature = "reqwest", not(feature = "resolve-http")))] + #[cfg(not(any(feature = "resolve-http", all(feature="reqwest", feature="rustls"), test)))] { - compile_error!("the `reqwest` feature does not enable HTTP schema resolving anymore, use the `resolve-http` feature instead"); + compile_error!( + r#"the `reqwest` feature alone does not enable HTTP schema resolving anymore. +Use the `resolve-http` feature which enables `native-tls` as well; +or both `reqwest` and `rustls` features together, if you prefer rustls."# + ); } - #[cfg(any(feature = "resolve-http", test))] + #[cfg(any(feature = "resolve-http", all(feature="reqwest", feature="rustls"), test))] { let response = reqwest::blocking::get(url.as_str())?; let document: Value = response.json()?; Ok(Arc::new(document)) } - #[cfg(not(any(feature = "resolve-http", test)))] + #[cfg(not(any(feature = "resolve-http", all(feature="reqwest", feature="rustls"), test)))] Err(anyhow::anyhow!("`resolve-http` feature or a custom resolver is required to resolve external schemas via HTTP")) } "file" => {