Skip to content

Commit

Permalink
build(deps): update fluent-uri requirement from 0.1 to 0.2 (#31)
Browse files Browse the repository at this point in the history
* build(deps): update fluent-uri requirement from 0.1 to 0.2

Updates the requirements on [fluent-uri](https://github.com/yescallop/fluent-uri-rs) to permit the latest version.
- [Release notes](https://github.com/yescallop/fluent-uri-rs/releases)
- [Commits](yescallop/fluent-uri-rs@v0.1.0...v0.2.0)

---
updated-dependencies:
- dependency-name: fluent-uri
  dependency-type: direct:production
...

* build: adapt code to fluent_uri 0.2
* chore: allow license "MIT-0" for dependencies

---------

Signed-off-by: dependabot[bot] <[email protected]>
Signed-off-by: David Bernard <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: David Bernard <[email protected]>
  • Loading branch information
dependabot[bot] and davidB authored Aug 31, 2024
1 parent f2b4ee7 commit 9a67c86
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 19 deletions.
2 changes: 1 addition & 1 deletion cdevents-sdk/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ description = "A Rust SDK for CDEvents"

[dependencies]
cloudevents-sdk = { version = "0.7", optional = true, default-features = false }
fluent-uri = "0.1"
fluent-uri = "0.2"
proptest = { version = "1.4", optional = true }
proptest-derive = { version = "0.5", optional = true }
serde = { version = "1.0", features = ["derive"] }
Expand Down
2 changes: 1 addition & 1 deletion cdevents-sdk/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ pub enum Error {
#[error("Empty data in cloudevent")]
DataNotFoundInCloudEvent,
#[error(transparent)]
UriParseError( #[from] fluent_uri::ParseError),
UriParseError( #[from] fluent_uri::error::ParseError<String>),
#[error(transparent)]
SerdeJsonError( #[from] serde_json::Error),
#[error("unknown error")]
Expand Down
6 changes: 3 additions & 3 deletions cdevents-sdk/src/serde.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@ pub(crate) mod datetime {
pub(crate) mod fluent_uri {
use serde::{de::Error, Deserialize, Deserializer, Serializer};

pub fn deserialize<'de, D>(deserializer: D) -> Result<fluent_uri::Uri<String>, D::Error>
pub fn deserialize<'de, D>(deserializer: D) -> Result<fluent_uri::UriRef<String>, D::Error>
where
D: Deserializer<'de>,
{
let txt = String::deserialize(deserializer)?;
fluent_uri::Uri::parse_from(txt).map_err(|e| D::Error::custom(e.1))
fluent_uri::UriRef::parse(txt).map_err(D::Error::custom)
}

pub fn serialize<S>(input: &fluent_uri::Uri<String>, serializer: S) -> Result<S::Ok, S::Error>
pub fn serialize<S>(input: &fluent_uri::UriRef<String>, serializer: S) -> Result<S::Ok, S::Error>
where
S: Serializer,
{
Expand Down
14 changes: 7 additions & 7 deletions cdevents-sdk/src/uri.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// wrapper for fluent_uri::Uri to allow for restristed set of operations
// wrapper for fluent_uri::UriRef to allow for restristed set of operations
// and to complete currently missing features.
// Why fluent_uri?
// - support uri & uri-reference, preserve the original string, but young, doesn't impl PartialEq,...
Expand All @@ -14,9 +14,9 @@ use crate::UriReference;
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[cfg_attr(feature = "testkit", derive(Arbitrary))]
pub struct Uri(
#[cfg_attr(feature = "testkit", proptest(value = "fluent_uri::Uri::parse_from(\"https://example.com/\".to_owned()).unwrap()"))] //TODO generate random value
#[cfg_attr(feature = "testkit", proptest(value = "fluent_uri::UriRef::parse(\"https://example.com/\".to_owned()).unwrap()"))] //TODO generate random value
#[serde(with = "crate::serde::fluent_uri")]
pub(crate) fluent_uri::Uri<String>
pub(crate) fluent_uri::UriRef<String>
);

impl PartialEq for Uri {
Expand All @@ -32,7 +32,7 @@ impl FromStr for Uri {

fn from_str(s: &str) -> Result<Self, Self::Err> {
//TODO check it's not a reference URI
fluent_uri::Uri::parse_from(s.to_owned()).map_err(|(_,e)| e.into()).map(Uri)
fluent_uri::UriRef::parse(s.to_owned()).map_err(Self::Err::from).map(Uri)
}
}

Expand All @@ -48,15 +48,15 @@ impl TryFrom<&str> for Uri {
type Error = crate::Error;

fn try_from(s: &str) -> Result<Self, Self::Error> {
fluent_uri::Uri::parse_from(s.to_owned()).map_err(|(_,e)| e.into()).map(Uri)
fluent_uri::UriRef::parse(s.to_owned()).map_err(Self::Error::from).map(Uri)
}
}

impl TryFrom<String> for Uri {
type Error = crate::Error;

fn try_from(s: String) -> Result<Self, Self::Error> {
fluent_uri::Uri::parse_from(s).map_err(|(_,e)| e.into()).map(Uri)
fluent_uri::UriRef::parse(s).map_err(Self::Error::from).map(Uri)
}
}

Expand All @@ -72,7 +72,7 @@ impl Uri {
}
}

// impl From<Uri> for fluent_uri::Uri<String> {
// impl From<Uri> for fluent_uri::UriRef<String> {
// fn from(uri: Uri) -> Self {
// uri.0
// }
Expand Down
10 changes: 5 additions & 5 deletions cdevents-sdk/src/uri_reference.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use crate::Uri;
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct UriReference(
#[serde(with = "crate::serde::fluent_uri")]
pub(crate) fluent_uri::Uri<String>
pub(crate) fluent_uri::UriRef<String>
);

impl PartialEq for UriReference {
Expand All @@ -21,7 +21,7 @@ impl FromStr for UriReference {
type Err = crate::Error;

fn from_str(s: &str) -> Result<Self, Self::Err> {
fluent_uri::Uri::parse_from(s.to_owned()).map_err(|(_,e)| e.into()).map(UriReference)
fluent_uri::UriRef::parse(s.to_owned()).map_err(Self::Err::from).map(UriReference)
}
}

Expand All @@ -37,15 +37,15 @@ impl TryFrom<&str> for UriReference {
type Error = crate::Error;

fn try_from(s: &str) -> Result<Self, Self::Error> {
fluent_uri::Uri::parse_from(s.to_owned()).map_err(|(_,e)| e.into()).map(UriReference)
fluent_uri::UriRef::parse(s.to_owned()).map_err(Self::Error::from).map(UriReference)
}
}

impl TryFrom<String> for UriReference {
type Error = crate::Error;

fn try_from(s: String) -> Result<Self, Self::Error> {
fluent_uri::Uri::parse_from(s).map_err(|(_,e)| e.into()).map(UriReference)
fluent_uri::UriRef::parse(s).map_err(Self::Error::from).map(UriReference)
}
}

Expand All @@ -61,7 +61,7 @@ impl UriReference {
}
}

// impl From<UriReference> for fluent_uri::Uri<String> {
// impl From<UriReference> for fluent_uri::UriRef<String> {
// fn from(uri: UriReference) -> Self {
// uri.0
// }
Expand Down
2 changes: 1 addition & 1 deletion cdevents-sdk/tests/specs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ fn can_serde_example(#[files("../cdevents-specs/spec-*/examples/*.json")] #[file
// "https://example.org"
// rhs:
// "https://example.org/"
// But it's not the case with fluent_uri::Uri
// But it's not the case with fluent_uri::UriRef
//
// example_txt = example_txt.replace("\"https://example.org\"", "\"https://example.org/\"");

Expand Down
2 changes: 1 addition & 1 deletion tools/cargo-deny/deny.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ wildcards = "deny"

[licenses]
confidence-threshold = 0.95
allow = ["Apache-2.0", "MIT", "Unicode-DFS-2016"]
allow = ["Apache-2.0", "MIT", "MIT-0", "Unicode-DFS-2016"]
exceptions = []

# The unpublished packages (generator) would be ignored now
Expand Down

0 comments on commit 9a67c86

Please sign in to comment.