Brain Docs

Reference

TypeScript SDKInstallationHTTP clientWire client
getSchemavalidateSchemauploadSchemareplaceSchemadropSchemalistSchemaslistExtractors
ErrorsRetriesPagination
Brain/Docs
✦ ASKBrain on GitHubDashboard
TypeScript SDKSchemareplaceSchema

replaceSchema

Replace the schema wholesale — and read the count of live rows it destroyed.

PURPOSE

Replace the schema wholesale rather than publishing a compatible new version. Rows that no longer fit are dropped — and you have to say so explicitly.

PUT/v1/schemaBearer API keystable
replaceSchema(input: SchemaReplaceInput): Promise<SchemaReplaceResult>
Handshake credentialstable
replaceSchema(request: SchemaReplaceRequest): Promise<SchemaReplaceResponse>

Parameters

ParameterTypeRequired
schemaDocumentstringrequired

The replacement.

forceDropExistingbooleanrequired

Required, not optional — you must state whether rows that no longer fit may be dropped. false makes the call fail rather than destroy data.

Returns

FieldTypePresence
namespace / schemaVersion—always

Where it landed.

droppedCountintegeralways

The number of live rows this replacement destroyed. Read it.

validationErrorsSchemaError[]always

Empty on success.

Validation failures are not exceptions

This verb resolves with a populated validationErrors array rather than throwing. Code that only wraps the call in a try/catch treats an invalid schema as a successful one. Check the array.

See also
uploadSchemadropSchema

Was this page helpful?

uploadSchema

Publish a new schema version, with a dry run and an explicit opt-in for breaking changes.

dropSchema

Remove one declaration — and find out how many live rows still depend on it.

On this page

ParametersReturns
Suggest an editOpen in Playground