From cf26b77fdf314e311a670421d4dd50bb8b705d8b Mon Sep 17 00:00:00 2001 From: alemi Date: Wed, 19 Jun 2024 17:56:05 +0200 Subject: [PATCH] fix(apb): add link type, tag is Link --- apb/src/types/link.rs | 4 ++++ apb/src/types/object/mod.rs | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/apb/src/types/link.rs b/apb/src/types/link.rs index ec8a427..0506ef9 100644 --- a/apb/src/types/link.rs +++ b/apb/src/types/link.rs @@ -18,6 +18,7 @@ crate::strenum! { } pub trait Link : crate::Base { + fn link_type(&self) -> Field { Err(FieldErr("type")) } fn href(&self) -> &str; fn rel(&self) -> Field<&str> { Err(FieldErr("rel")) } fn media_type(&self) -> Field<&str> { Err(FieldErr("mediaType")) } // also in obj @@ -29,6 +30,7 @@ pub trait Link : crate::Base { } pub trait LinkMut : crate::BaseMut { + fn set_link_type(self, val: Option) -> Self; fn set_href(self, href: &str) -> Self; fn set_rel(self, val: Option<&str>) -> Self; fn set_media_type(self, val: Option<&str>) -> Self; // also in obj @@ -56,6 +58,7 @@ impl Link for serde_json::Value { } } + crate::getter! { link_type -> type LinkType } crate::getter! { rel -> &str } crate::getter! { mediaType -> &str } crate::getter! { name -> &str } @@ -80,6 +83,7 @@ impl LinkMut for serde_json::Value { self } + crate::setter! { link_type -> type LinkType } crate::setter! { rel -> &str } crate::setter! { mediaType -> &str } crate::setter! { name -> &str } diff --git a/apb/src/types/object/mod.rs b/apb/src/types/object/mod.rs index b8faaa7..0a57206 100644 --- a/apb/src/types/object/mod.rs +++ b/apb/src/types/object/mod.rs @@ -92,7 +92,8 @@ pub trait Object : Base { fn summary(&self) -> Field<&str> { Err(FieldErr("summary")) } /// One or more "tags" that have been associated with an objects. A tag can be any kind of Object /// The key difference between attachment and tag is that the former implies association by inclusion, while the latter implies associated by reference - fn tag(&self) -> Node { Node::Empty } + // TODO technically this is an object? but spec says that it works my reference, idk + fn tag(&self) -> Node { Node::Empty } /// Identifies one or more links to representations of the object fn url(&self) -> Node { Node::Empty } /// Identifies an entity considered to be part of the public primary audience of an Object