upload_schema
Publish a new schema version, with a dry run and an explicit opt-in for breaking changes.
async fn upload_schema(&self, input: &SchemaUploadInput) -> Result<SchemaUploadResult, BrainHttpError>async fn upload_schema(&self, request: &SchemaUploadRequest) -> Result<SchemaUploadResponse>Parameters
schema_documentstringrequiredThe document.
dry_runbooleanoptionalRun the whole upload path, including the compatibility check, and store nothing.
allow_breakingbooleanoptionalAccept a document that is not backward compatible. Without it, a breaking change is refused.
Returns
namespace / schema_version—alwaysWhere it landed.
backward_compatiblebooleanalwaysWhether the new version can read what the old one wrote. false here with breaking changes allowed means you took the break deliberately.
validation_errorsSchemaError[]alwaysEmpty on success.
Example
let check = brain.validate_schema(&SchemaValidateInput { schema_document: doc.clone() }).await?;
if !check.validation_errors.is_empty() {
for e in &check.validation_errors {
eprintln!("{}:{} {} {}", e.line, e.column, e.code, e.message);
}
return Ok(());
}
let up = brain.upload_schema(&SchemaUploadInput { schema_document: doc, ..Default::default() }).await?;
if !up.backward_compatible {
eprintln!("breaking change accepted");
}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.
Uploading a schema needs the SchemaUpload grant when the request carries an
act_as selector. See act_as.
Was this page helpful?