diff --git a/cedar-policy-validator/src/json_schema.rs b/cedar-policy-validator/src/json_schema.rs index b9057a34ea..8f2e69bfae 100644 --- a/cedar-policy-validator/src/json_schema.rs +++ b/cedar-policy-validator/src/json_schema.rs @@ -983,7 +983,7 @@ impl From for ActionEntityUID { /// this [`Type`], including recursively. /// See notes on [`Fragment`]. #[derive(Educe, Debug, Clone, Serialize)] -#[educe(PartialEq, Eq, PartialOrd, Ord)] +#[educe(PartialEq(bound(N: PartialEq)), Eq, PartialOrd, Ord(bound(N: Ord)))] // This enum is `untagged` with these variants as a workaround to a serde // limitation. It is not possible to have the known variants on one enum, and // then, have catch-all variant for any unrecognized tag in the same enum that @@ -1603,7 +1603,7 @@ impl RecordType { /// this [`TypeVariant`], including recursively. /// See notes on [`Fragment`]. #[derive(Educe, Debug, Clone, Serialize, Deserialize)] -#[educe(PartialEq(bound(N: PartialEq)), Eq, PartialOrd, Ord)] +#[educe(PartialEq(bound(N: PartialEq)), Eq, PartialOrd, Ord(bound(N: Ord)))] #[serde(tag = "type")] #[serde(bound(deserialize = "N: Deserialize<'de> + From"))] #[cfg_attr(feature = "wasm", derive(tsify::Tsify))] @@ -3592,3 +3592,24 @@ mod annotations { test_unknown_fields(src, "`bar`", ATTRIBUTE_TYPE_EXPECTED_ATTRIBUTES); } } + +#[cfg(test)] +mod ord { + use super::{InternalName, RawName, Type, TypeVariant}; + use std::collections::BTreeSet; + + /// Tests that `Type` and `Type` are `Ord` + #[test] + fn type_ord() { + let mut set: BTreeSet> = BTreeSet::default(); + set.insert(Type::Type { + ty: TypeVariant::String, + loc: None, + }); + let mut set: BTreeSet> = BTreeSet::default(); + set.insert(Type::Type { + ty: TypeVariant::String, + loc: None, + }); + } +}