Skip to main content

citum_schema_data/reference/
mod.rs

1/*
2SPDX-License-Identifier: MIT OR Apache-2.0
3SPDX-FileCopyrightText: © 2023-2026 Bruce D'Arcus and Citum contributors
4*/
5
6//! A reference is a bibliographic item, such as a book, article, or web page.
7//! It is the basic unit of bibliographic data.
8
9pub mod citeproc_markup;
10pub mod contributor;
11#[cfg(feature = "legacy-convert")]
12pub mod conversion;
13pub mod date;
14pub mod types;
15
16mod accessors;
17mod classes;
18mod ctors;
19mod input;
20mod serde_impl;
21
22#[cfg(all(test, feature = "legacy-convert"))]
23#[allow(
24    clippy::unwrap_used,
25    clippy::expect_used,
26    clippy::panic,
27    clippy::indexing_slicing,
28    clippy::todo,
29    clippy::unimplemented,
30    clippy::unreachable,
31    clippy::get_unwrap,
32    reason = "Panicking is acceptable and often desired in tests."
33)]
34mod tests;
35
36#[cfg(test)]
37#[allow(
38    clippy::unwrap_used,
39    clippy::expect_used,
40    clippy::panic,
41    clippy::indexing_slicing,
42    clippy::todo,
43    clippy::unimplemented,
44    clippy::unreachable,
45    clippy::get_unwrap,
46    reason = "Panicking is acceptable and often desired in tests."
47)]
48mod discriminator_tests;
49
50#[cfg(test)]
51#[allow(
52    clippy::unwrap_used,
53    clippy::expect_used,
54    clippy::panic,
55    clippy::indexing_slicing,
56    clippy::todo,
57    clippy::unimplemented,
58    clippy::unreachable,
59    clippy::get_unwrap,
60    reason = "Panicking is acceptable and often desired in tests."
61)]
62mod normalize_tests;
63
64#[cfg(test)]
65#[allow(
66    clippy::unwrap_used,
67    clippy::expect_used,
68    clippy::panic,
69    clippy::indexing_slicing,
70    clippy::todo,
71    clippy::unimplemented,
72    clippy::unreachable,
73    clippy::get_unwrap,
74    reason = "Panicking is acceptable and often desired in tests."
75)]
76mod numbering_tests;
77
78pub use self::classes::{ClassExtension, ReferenceClass};
79pub use self::contributor::{
80    Contributor, ContributorEntry, ContributorGender, ContributorList, ContributorRole, FlatName,
81    SimpleName, StructuredName,
82};
83pub use self::date::DateValue;
84pub(crate) use self::input::EMPTY_FIELD_LANGUAGES;
85pub use self::input::{IdentifierName, InputReference, SupplementaryIdentifiers, UnknownClassData};
86pub use self::types::common::{
87    FieldLanguageMap, LangID, MultilingualString, NumOrStr, Numbering, NumberingType, Place,
88    Publisher, RefID, RichText, Title,
89};
90pub use self::types::legal::{Brief, Hearing, LegalCase, Regulation, Statute, Treaty};
91pub use self::types::specialized::{
92    AudioVisualType, AudioVisualWork, Classic, Dataset, Event, Patent, Software, Standard, WorkCore,
93};
94pub use self::types::structural::{
95    Collection, CollectionComponent, CollectionType, Monograph, MonographComponentType,
96    MonographType, Serial, SerialComponent, SerialComponentType, SerialType,
97};
98
99#[cfg(feature = "schema")]
100use schemars::JsonSchema;
101use serde::{Deserialize, Serialize};
102#[cfg(feature = "bindings")]
103use specta::Type;
104
105/// A relation to another bibliographic entity.
106///
107/// Untagged in serde to allow either an inline object or a string ID reference.
108/// Used for both hierarchical (`container`) and associative (`original`, `reviewed`, `series`) links.
109#[derive(Debug, Deserialize, Serialize, Clone, PartialEq)]
110#[cfg_attr(feature = "schema", derive(JsonSchema))]
111#[cfg_attr(feature = "bindings", derive(Type))]
112#[serde(untagged)]
113pub enum WorkRelation {
114    /// The target work is referenced by its ID (resolved at render time).
115    Id(RefID),
116    /// The target work is embedded inline.
117    Embedded(Box<InputReference>),
118}