Repository navigation
GCS Schemas
github-actions[bot] edited this page Sep 29, 2026
·
1 revision
The @tundraconnect/gcs/schemas subpath exports Guardian validators and
inferred types. Client methods validate every payload before returning it.
import {
type ObjectSchema,
ObjectSchemaObject,
} from '@tundraconnect/gcs/schemas';
const payload: unknown = {
name: 'reports/2024-01.csv',
bucket: 'my-bucket',
contentType: 'text/csv',
size: '1024',
};
const [error, object] = ObjectSchemaObject.safeParse(payload);
if (error || !object) throw error;
const typedObject: ObjectSchema = object;
console.log(typedObject.name, typedObject.size);| Schema | Used by |
|---|---|
ObjectSchemaObject |
putObject, putObjectStream, getObject, getObjectStream, headObject
|
ListObjectsResponseSchemaObject |
listObjects |
ErrorEnvelopeSchemaObject |
Vendor error envelopes |
ErrorDetailSchemaObject |
One entry of an error envelope's errors array |
-
ObjectSchemaObject.sizeis kept as astring, matching GCS's own JSON representation — it's a decimal-string int64 precisely because it can exceedNumber.MAX_SAFE_INTEGER; parsing it to anumberwould silently lose precision for very large objects. -
ObjectSchemaObjectandListObjectsResponseSchemaObjectboth use.passthrough(): GCS documents many more Object-resource fields (owner,acl,retention, ...) than this connect models explicitly, and the vendor is free to add new ones. -
ListObjectsResponseSchemaObject.itemsis.optional()because GCS omits the field entirely — rather than returning[]— when a bucket/prefix has no matching objects.GCS.listObjects()normalises a missingitemsto an emptyobjectsarray in its return value.