jacquard_api/pub_leaflet/blocks/
blockquote.rs1use jacquard_common::CowStr;
9
10#[allow(unused_imports)]
11use jacquard_common::deps::codegen::unicode_segmentation::UnicodeSegmentation;
12use jacquard_derive::{IntoStatic, lexicon};
13use jacquard_lexicon::lexicon::LexiconDoc;
14use jacquard_lexicon::schema::LexiconSchema;
15
16#[allow(unused_imports)]
17use jacquard_lexicon::validation::{ConstraintError, ValidationPath};
18use serde::{Serialize, Deserialize};
19use crate::pub_leaflet::richtext::facet::Facet;
20
21#[lexicon]
22#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
23#[serde(rename_all = "camelCase")]
24pub struct Blockquote<'a> {
25 #[serde(skip_serializing_if = "Option::is_none")]
26 #[serde(borrow)]
27 pub facets: Option<Vec<Facet<'a>>>,
28 #[serde(borrow)]
29 pub plaintext: CowStr<'a>,
30}
31
32impl<'a> LexiconSchema for Blockquote<'a> {
33 fn nsid() -> &'static str {
34 "pub.leaflet.blocks.blockquote"
35 }
36 fn def_name() -> &'static str {
37 "main"
38 }
39 fn lexicon_doc() -> LexiconDoc<'static> {
40 lexicon_doc_pub_leaflet_blocks_blockquote()
41 }
42 fn validate(&self) -> Result<(), ConstraintError> {
43 Ok(())
44 }
45}
46
47fn lexicon_doc_pub_leaflet_blocks_blockquote() -> LexiconDoc<'static> {
48 #[allow(unused_imports)]
49 use jacquard_common::{CowStr, deps::smol_str::SmolStr, types::blob::MimeType};
50 use jacquard_lexicon::lexicon::*;
51 use alloc::collections::BTreeMap;
52 LexiconDoc {
53 lexicon: Lexicon::Lexicon1,
54 id: CowStr::new_static("pub.leaflet.blocks.blockquote"),
55 defs: {
56 let mut map = BTreeMap::new();
57 map.insert(
58 SmolStr::new_static("main"),
59 LexUserType::Object(LexObject {
60 required: Some(vec![SmolStr::new_static("plaintext")]),
61 properties: {
62 #[allow(unused_mut)]
63 let mut map = BTreeMap::new();
64 map.insert(
65 SmolStr::new_static("facets"),
66 LexObjectProperty::Array(LexArray {
67 items: LexArrayItem::Ref(LexRef {
68 r#ref: CowStr::new_static("pub.leaflet.richtext.facet"),
69 ..Default::default()
70 }),
71 ..Default::default()
72 }),
73 );
74 map.insert(
75 SmolStr::new_static("plaintext"),
76 LexObjectProperty::String(LexString { ..Default::default() }),
77 );
78 map
79 },
80 ..Default::default()
81 }),
82 );
83 map
84 },
85 ..Default::default()
86 }
87}