Stop being pedantic by default
Up to now, the xmpp-rs projects have been very strict about incoming
data. This has served us, as developers of the libraries, well,
uncovering bugs in our and remote implementations which we could then
get fixed.
However, this behaviour is unexpected to users of the library. In the
XMPP world, unexpected child elements and attributes are generally
expected to be ignored. While this could be opted-into previously, the
feature flag for that sounded more dangerous than it was
("disable-validation"). In addition, the tribal knowledge needed to know
about that feature flag may not have reached some people who tried the
library and gave up because of that.
With this change, we make the non-pedantic behaviour the default. For
development and debugging purposes, users can always opt into the
pedantic behaviour as needed, using the newly-introduced `pedantic`
feature flags on all affected crates.
This commit is contained in:
parent
65c1f5ab10
commit
e2dcd8ac66
41 changed files with 99 additions and 107 deletions
|
|
@ -349,17 +349,17 @@ pub trait AsOptionalXmlText {
|
|||
pub enum UnknownAttributePolicy {
|
||||
/// All unknown attributes are discarded.
|
||||
///
|
||||
/// This is the default policy if the crate is built with the
|
||||
/// `non-pedantic` feature.
|
||||
#[cfg_attr(feature = "non-pedantic", default)]
|
||||
/// This is the default policy if the crate is built without the
|
||||
/// `pedantic` feature.
|
||||
#[cfg_attr(not(feature = "pedantic"), default)]
|
||||
Discard,
|
||||
|
||||
/// The first unknown attribute which is encountered generates a fatal
|
||||
/// parsing error.
|
||||
///
|
||||
/// This is the default policy if the crate is built **without** the
|
||||
/// `non-pedantic` feature.
|
||||
#[cfg_attr(not(feature = "non-pedantic"), default)]
|
||||
/// This is the default policy if the crate is built with the
|
||||
/// `pedantic` feature.
|
||||
#[cfg_attr(feature = "pedantic", default)]
|
||||
Fail,
|
||||
}
|
||||
|
||||
|
|
@ -386,17 +386,17 @@ impl UnknownAttributePolicy {
|
|||
pub enum UnknownChildPolicy {
|
||||
/// All unknown children are discarded.
|
||||
///
|
||||
/// This is the default policy if the crate is built with the
|
||||
/// `non-pedantic` feature.
|
||||
#[cfg_attr(feature = "non-pedantic", default)]
|
||||
/// This is the default policy if the crate is built without the
|
||||
/// `pedantic` feature.
|
||||
#[cfg_attr(not(feature = "pedantic"), default)]
|
||||
Discard,
|
||||
|
||||
/// The first unknown child which is encountered generates a fatal
|
||||
/// parsing error.
|
||||
///
|
||||
/// This is the default policy if the crate is built **without** the
|
||||
/// `non-pedantic` feature.
|
||||
#[cfg_attr(not(feature = "non-pedantic"), default)]
|
||||
/// This is the default policy if the crate is built with the
|
||||
/// `pedantic` feature.
|
||||
#[cfg_attr(feature = "pedantic", default)]
|
||||
Fail,
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue