@@ -98,28 +98,28 @@ export const User = t
9898 * Product catalog schema with arrays and formatted numbers
9999 */
100100export const Product = t . Object (
101- t . prop ( 'id' , t . String ( { format : 'ascii' } ) ) ,
102- t . prop ( 'name' , t . String ( { min : 1 , max : 100 } ) ) ,
103- t . prop ( 'price' , t . Number ( { format : 'f64' , gte : 0 } ) ) ,
104- t . prop ( 'inStock' , t . bool ) ,
105- t . prop ( 'categories' , t . Array ( t . str , { min : 1 } ) ) ,
106- t . prop ( 'tags' , t . Array ( t . str ) ) ,
107- t . propOpt ( 'description' , t . String ( { max : 1000 } ) ) ,
108- t . propOpt ( 'discount' , t . Number ( { gte : 0 , lte : 1 } ) ) ,
101+ t . Key ( 'id' , t . String ( { format : 'ascii' } ) ) ,
102+ t . Key ( 'name' , t . String ( { min : 1 , max : 100 } ) ) ,
103+ t . Key ( 'price' , t . Number ( { format : 'f64' , gte : 0 } ) ) ,
104+ t . Key ( 'inStock' , t . bool ) ,
105+ t . Key ( 'categories' , t . Array ( t . str , { min : 1 } ) ) ,
106+ t . Key ( 'tags' , t . Array ( t . str ) ) ,
107+ t . KeyOpt ( 'description' , t . String ( { max : 1000 } ) ) ,
108+ t . KeyOpt ( 'discount' , t . Number ( { gte : 0 , lte : 1 } ) ) ,
109109) ;
110110
111111/**
112112 * Blog post schema with timestamps and rich content
113113 */
114114export const BlogPost = t . Object (
115- t . prop ( 'id' , t . str ) ,
116- t . prop ( 'title' , t . String ( { min : 1 , max : 200 } ) ) ,
117- t . prop ( 'content' , t . str ) ,
118- t . prop ( 'author' , t . Ref < typeof User > ( 'User' ) ) ,
119- t . prop ( 'publishedAt' , t . Number ( { format : 'u64' } ) ) ,
120- t . prop ( 'status' , t . enum ( 'draft' , 'published' , 'archived' ) ) ,
121- t . propOpt ( 'updatedAt' , t . Number ( { format : 'u64' } ) ) ,
122- t . propOpt ( 'tags' , t . Array ( t . str ) ) ,
115+ t . Key ( 'id' , t . str ) ,
116+ t . Key ( 'title' , t . String ( { min : 1 , max : 200 } ) ) ,
117+ t . Key ( 'content' , t . str ) ,
118+ t . Key ( 'author' , t . Ref < typeof User > ( 'User' ) ) ,
119+ t . Key ( 'publishedAt' , t . Number ( { format : 'u64' } ) ) ,
120+ t . Key ( 'status' , t . enum ( 'draft' , 'published' , 'archived' ) ) ,
121+ t . KeyOpt ( 'updatedAt' , t . Number ( { format : 'u64' } ) ) ,
122+ t . KeyOpt ( 'tags' , t . Array ( t . str ) ) ,
123123) ;
124124
125125/**
@@ -145,31 +145,31 @@ export const ApiResponse = t.Or(
145145 * File metadata schema with binary data
146146 */
147147export const FileMetadata = t . Object (
148- t . prop ( 'name' , t . str ) ,
149- t . prop ( 'size' , t . Number ( { format : 'u64' , gte : 0 } ) ) ,
150- t . prop ( 'mimeType' , t . str ) ,
151- t . prop ( 'data' , t . Binary ( t . any ) ) ,
152- t . prop ( 'checksum' , t . String ( { format : 'ascii' , min : 64 , max : 64 } ) ) ,
153- t . prop ( 'uploadedAt' , t . Number ( { format : 'u64' } ) ) ,
154- t . propOpt ( 'metadata' , t . Map ( t . str ) ) ,
148+ t . Key ( 'name' , t . str ) ,
149+ t . Key ( 'size' , t . Number ( { format : 'u64' , gte : 0 } ) ) ,
150+ t . Key ( 'mimeType' , t . str ) ,
151+ t . Key ( 'data' , t . Binary ( t . any ) ) ,
152+ t . Key ( 'checksum' , t . String ( { format : 'ascii' , min : 64 , max : 64 } ) ) ,
153+ t . Key ( 'uploadedAt' , t . Number ( { format : 'u64' } ) ) ,
154+ t . KeyOpt ( 'metadata' , t . Map ( t . str ) ) ,
155155) ;
156156
157157/**
158158 * Configuration schema with maps and default values
159159 */
160160export const Configuration = t . Object (
161- t . prop ( 'environment' , t . enum ( 'development' , 'staging' , 'production' ) ) ,
162- t . prop (
161+ t . Key ( 'environment' , t . enum ( 'development' , 'staging' , 'production' ) ) ,
162+ t . Key (
163163 'database' ,
164164 t . object ( {
165165 host : t . str ,
166166 port : t . Number ( { format : 'u16' , gte : 1 , lte : 65535 } ) ,
167167 name : t . str ,
168168 } ) ,
169169 ) ,
170- t . prop ( 'features' , t . Map ( t . bool ) ) ,
171- t . prop ( 'secrets' , t . Map ( t . str ) ) ,
172- t . propOpt (
170+ t . Key ( 'features' , t . Map ( t . bool ) ) ,
171+ t . Key ( 'secrets' , t . Map ( t . str ) ) ,
172+ t . KeyOpt (
173173 'logging' ,
174174 t . object ( {
175175 level : t . enum ( 'debug' , 'info' , 'warn' , 'error' ) ,
@@ -182,29 +182,29 @@ export const Configuration = t.Object(
182182 * Event data schema with tuples and coordinates
183183 */
184184export const Event = t . Object (
185- t . prop ( 'id' , t . String ( { format : 'ascii' } ) ) ,
186- t . prop ( 'type' , t . enum ( 'click' , 'view' , 'purchase' , 'signup' ) ) ,
187- t . prop ( 'timestamp' , t . Number ( { format : 'u64' } ) ) ,
188- t . prop ( 'userId' , t . maybe ( t . str ) ) ,
189- t . prop ( 'location' , t . Tuple ( [ t . Number ( { format : 'f64' } ) , t . Number ( { format : 'f64' } ) ] ) ) ,
190- t . prop ( 'metadata' , t . Map ( t . Or ( t . str , t . num , t . bool ) ) ) ,
191- t . propOpt ( 'sessionId' , t . str ) ,
185+ t . Key ( 'id' , t . String ( { format : 'ascii' } ) ) ,
186+ t . Key ( 'type' , t . enum ( 'click' , 'view' , 'purchase' , 'signup' ) ) ,
187+ t . Key ( 'timestamp' , t . Number ( { format : 'u64' } ) ) ,
188+ t . Key ( 'userId' , t . maybe ( t . str ) ) ,
189+ t . Key ( 'location' , t . Tuple ( [ t . Number ( { format : 'f64' } ) , t . Number ( { format : 'f64' } ) ] ) ) ,
190+ t . Key ( 'metadata' , t . Map ( t . Or ( t . str , t . num , t . bool ) ) ) ,
191+ t . KeyOpt ( 'sessionId' , t . str ) ,
192192) ;
193193
194194/**
195195 * Contact information schema with formatted strings
196196 */
197197export const ContactInfo = t . Object (
198- t . prop (
198+ t . Key (
199199 'name' ,
200200 t . object ( {
201201 first : t . String ( { min : 1 } ) ,
202202 last : t . String ( { min : 1 } ) ,
203203 } ) ,
204204 ) ,
205- t . prop ( 'emails' , t . Array ( t . String ( { format : 'ascii' } ) , { min : 1 } ) ) ,
206- t . prop ( 'phones' , t . Array ( t . tuple ( t . enum ( 'home' , 'work' , 'mobile' ) , t . str ) ) ) ,
207- t . propOpt (
205+ t . Key ( 'emails' , t . Array ( t . String ( { format : 'ascii' } ) , { min : 1 } ) ) ,
206+ t . Key ( 'phones' , t . Array ( t . tuple ( t . enum ( 'home' , 'work' , 'mobile' ) , t . str ) ) ) ,
207+ t . KeyOpt (
208208 'address' ,
209209 t . object ( {
210210 street : t . str ,
@@ -213,20 +213,20 @@ export const ContactInfo = t.Object(
213213 postalCode : t . str ,
214214 } ) ,
215215 ) ,
216- t . propOpt ( 'socialMedia' , t . Map ( t . String ( { format : 'ascii' } ) ) ) ,
216+ t . KeyOpt ( 'socialMedia' , t . Map ( t . String ( { format : 'ascii' } ) ) ) ,
217217) ;
218218
219219/**
220220 * Database record schema with references
221221 */
222222export const DatabaseRecord = t . Object (
223- t . prop ( 'id' , t . String ( { format : 'ascii' } ) ) ,
224- t . prop ( 'createdAt' , t . Number ( { format : 'u64' } ) ) ,
225- t . prop ( 'updatedAt' , t . Number ( { format : 'u64' } ) ) ,
226- t . prop ( 'version' , t . Number ( { format : 'u32' , gte : 1 } ) ) ,
227- t . prop ( 'createdBy' , t . Ref < typeof User > ( 'User' ) ) ,
228- t . propOpt ( 'updatedBy' , t . Ref < typeof User > ( 'User' ) ) ,
229- t . propOpt ( 'deletedAt' , t . Number ( { format : 'u64' } ) ) ,
223+ t . Key ( 'id' , t . String ( { format : 'ascii' } ) ) ,
224+ t . Key ( 'createdAt' , t . Number ( { format : 'u64' } ) ) ,
225+ t . Key ( 'updatedAt' , t . Number ( { format : 'u64' } ) ) ,
226+ t . Key ( 'version' , t . Number ( { format : 'u32' , gte : 1 } ) ) ,
227+ t . Key ( 'createdBy' , t . Ref < typeof User > ( 'User' ) ) ,
228+ t . KeyOpt ( 'updatedBy' , t . Ref < typeof User > ( 'User' ) ) ,
229+ t . KeyOpt ( 'deletedAt' , t . Number ( { format : 'u64' } ) ) ,
230230) ;
231231
232232/**
@@ -260,7 +260,7 @@ export const EventStream = t.Function$(
260260 * Complex nested schema
261261 */
262262export const ComplexNested = t . Object (
263- t . prop (
263+ t . Key (
264264 'data' ,
265265 t . Map (
266266 t . Or (
@@ -278,7 +278,7 @@ export const ComplexNested = t.Object(
278278 ) ,
279279 ) ,
280280 ) ,
281- t . prop (
281+ t . Key (
282282 'metadata' ,
283283 t . object ( {
284284 version : t . str ,
0 commit comments