From 036693b6b23dc08da7aa6a208d7b7c8840ae1b1e Mon Sep 17 00:00:00 2001 From: Augustus Mayo Date: Wed, 20 Nov 2024 10:02:03 -0600 Subject: [PATCH] Remove ord derives and update tests --- Cargo.lock | 1 + v-api-permission-derive/Cargo.toml | 1 + v-api-permission-derive/src/lib.rs | 4 ++-- v-api-permission-derive/tests/derive.rs | 2 -- v-api/src/permissions.rs | 2 +- v-api/tests/import.rs | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 5c2637f..8355243 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2847,6 +2847,7 @@ dependencies = [ "quote", "schemars", "serde", + "serde_json", "syn", "uuid", "v-api", diff --git a/v-api-permission-derive/Cargo.toml b/v-api-permission-derive/Cargo.toml index bc3f3dc..c598921 100644 --- a/v-api-permission-derive/Cargo.toml +++ b/v-api-permission-derive/Cargo.toml @@ -16,6 +16,7 @@ syn = { workspace = true, features = ["derive", "extra-traits", "parsing"] } newtype-uuid = { workspace = true } schemars = { workspace = true } serde = { workspace = true, features = ["derive"] } +serde_json = { workspace = true } uuid = { workspace = true } v-api = { path = "../v-api" } v-model = { path = "../v-model" } diff --git a/v-api-permission-derive/src/lib.rs b/v-api-permission-derive/src/lib.rs index 703bd26..5def272 100644 --- a/v-api-permission-derive/src/lib.rs +++ b/v-api-permission-derive/src/lib.rs @@ -325,7 +325,7 @@ pub fn v_api(attr: TokenStream, input: TokenStream) -> TokenStream { // TODO: Inspect existing derive and add only the missing derive attributes // #[derive( - // Debug, Clone, PartialEq, Eq, Hash, serde::Serialize, serde::Deserialize, schemars::JsonSchema, PartialOrd, Ord, + // Debug, Clone, PartialEq, Eq, Hash, serde::Serialize, serde::Deserialize, schemars::JsonSchema, // )] quote! { @@ -441,7 +441,7 @@ fn from_system_permission_tokens( VPermission::ManageMagicLinkClientsAll => Self::ManageMagicLinkClientsAll, VPermission::CreateAccessToken => Self::CreateAccessToken, - VPermission::Removed => Self::Removed, + VPermission::Unsupported(inner) => Self::Unsupported(inner), } } } diff --git a/v-api-permission-derive/tests/derive.rs b/v-api-permission-derive/tests/derive.rs index 11e45ea..846524f 100644 --- a/v-api-permission-derive/tests/derive.rs +++ b/v-api-permission-derive/tests/derive.rs @@ -25,8 +25,6 @@ fn test_derive() { serde::Serialize, serde::Deserialize, schemars::JsonSchema, - PartialOrd, - Ord, )] enum AppPermissions { #[v_api(contract(kind = append, variant = CreateItems))] diff --git a/v-api/src/permissions.rs b/v-api/src/permissions.rs index 4169cfb..d00fd78 100644 --- a/v-api/src/permissions.rs +++ b/v-api/src/permissions.rs @@ -21,6 +21,6 @@ impl VAppPermissionResponse for T where T: Permission {} #[v_api(From(VPermission))] #[partial(VPermissionResponse, attributes(#[serde(tag = "kind", content = "value")]))] #[derive( - Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize, JsonSchema, PartialOrd, Ord, + Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize, JsonSchema )] pub enum VPermission {} diff --git a/v-api/tests/import.rs b/v-api/tests/import.rs index 879681c..3d17631 100644 --- a/v-api/tests/import.rs +++ b/v-api/tests/import.rs @@ -10,7 +10,7 @@ use v_api_permission_derive::v_api; #[v_api(From(VPermission))] #[derive( - Debug, Clone, Hash, PartialEq, Eq, PartialOrd, Ord, Deserialize, Serialize, JsonSchema, + Debug, Clone, Hash, PartialEq, Eq, Deserialize, Serialize, JsonSchema, )] enum Permissions { None,