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