upload_schema
Publish a new schema version, with a dry run and an explicit opt-in for breaking changes.
upload_schema(schema_document: str, dry_run=None, allow_breaking=None) -> SchemaUploadupload_schema(request: SchemaUploadRequest) -> SchemaUploadResponseParameters
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
check = brain.validate_schema(doc)
if check.validation_errors:
for e in check.validation_errors:
print(f"{e.line}:{e.column} {e.code} {e.message}")
return
up = brain.upload_schema(schema_document=doc)
if not up.backward_compatible:
print("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?