aws_smithy_schema/schema/
prelude.rs1use crate::{shape_id, Schema, ShapeType};
12
13pub static STRING: Schema = Schema::new(shape_id!("smithy.api", "String"), ShapeType::String);
15
16pub static BOOLEAN: Schema = Schema::new(shape_id!("smithy.api", "Boolean"), ShapeType::Boolean);
18
19pub static BYTE: Schema = Schema::new(shape_id!("smithy.api", "Byte"), ShapeType::Byte);
21
22pub static SHORT: Schema = Schema::new(shape_id!("smithy.api", "Short"), ShapeType::Short);
24
25pub static INTEGER: Schema = Schema::new(shape_id!("smithy.api", "Integer"), ShapeType::Integer);
27
28pub static LONG: Schema = Schema::new(shape_id!("smithy.api", "Long"), ShapeType::Long);
30
31pub static FLOAT: Schema = Schema::new(shape_id!("smithy.api", "Float"), ShapeType::Float);
33
34pub static DOUBLE: Schema = Schema::new(shape_id!("smithy.api", "Double"), ShapeType::Double);
36
37pub static BIG_INTEGER: Schema =
39 Schema::new(shape_id!("smithy.api", "BigInteger"), ShapeType::BigInteger);
40
41pub static BIG_DECIMAL: Schema =
43 Schema::new(shape_id!("smithy.api", "BigDecimal"), ShapeType::BigDecimal);
44
45pub static BLOB: Schema = Schema::new(shape_id!("smithy.api", "Blob"), ShapeType::Blob);
47
48pub static TIMESTAMP: Schema =
50 Schema::new(shape_id!("smithy.api", "Timestamp"), ShapeType::Timestamp);
51
52pub static DOCUMENT: Schema = Schema::new(shape_id!("smithy.api", "Document"), ShapeType::Document);
54
55#[cfg(test)]
56mod tests {
57 use super::*;
58
59 #[test]
60 fn test_string_schema() {
61 assert_eq!(STRING.shape_id().as_str(), "smithy.api#String");
62 assert_eq!(STRING.shape_type(), ShapeType::String);
63 assert!(STRING.is_string());
64 assert!(STRING.traits().is_none());
65 }
66
67 #[test]
68 fn test_boolean_schema() {
69 assert_eq!(BOOLEAN.shape_id().as_str(), "smithy.api#Boolean");
70 assert_eq!(BOOLEAN.shape_type(), ShapeType::Boolean);
71 assert!(BOOLEAN.traits().is_none());
72 }
73
74 #[test]
75 fn test_numeric_schemas() {
76 assert_eq!(BYTE.shape_type(), ShapeType::Byte);
77 assert_eq!(SHORT.shape_type(), ShapeType::Short);
78 assert_eq!(INTEGER.shape_type(), ShapeType::Integer);
79 assert_eq!(LONG.shape_type(), ShapeType::Long);
80 assert_eq!(FLOAT.shape_type(), ShapeType::Float);
81 assert_eq!(DOUBLE.shape_type(), ShapeType::Double);
82 assert_eq!(BIG_INTEGER.shape_type(), ShapeType::BigInteger);
83 assert_eq!(BIG_DECIMAL.shape_type(), ShapeType::BigDecimal);
84 }
85
86 #[test]
87 fn test_blob_schema() {
88 assert_eq!(BLOB.shape_id().as_str(), "smithy.api#Blob");
89 assert_eq!(BLOB.shape_type(), ShapeType::Blob);
90 assert!(BLOB.is_blob());
91 }
92
93 #[test]
94 fn test_timestamp_schema() {
95 assert_eq!(TIMESTAMP.shape_id().as_str(), "smithy.api#Timestamp");
96 assert_eq!(TIMESTAMP.shape_type(), ShapeType::Timestamp);
97 }
98
99 #[test]
100 fn test_document_schema() {
101 assert_eq!(DOCUMENT.shape_id().as_str(), "smithy.api#Document");
102 assert_eq!(DOCUMENT.shape_type(), ShapeType::Document);
103 }
104
105 #[test]
106 fn test_all_prelude_types_are_simple() {
107 assert!(STRING.shape_type().is_simple());
108 assert!(BOOLEAN.shape_type().is_simple());
109 assert!(BYTE.shape_type().is_simple());
110 assert!(SHORT.shape_type().is_simple());
111 assert!(INTEGER.shape_type().is_simple());
112 assert!(LONG.shape_type().is_simple());
113 assert!(FLOAT.shape_type().is_simple());
114 assert!(DOUBLE.shape_type().is_simple());
115 assert!(BIG_INTEGER.shape_type().is_simple());
116 assert!(BIG_DECIMAL.shape_type().is_simple());
117 assert!(BLOB.shape_type().is_simple());
118 assert!(TIMESTAMP.shape_type().is_simple());
119 assert!(DOCUMENT.shape_type().is_simple());
120 }
121}