Skip to main content

run_create_schema

Function run_create_schema 

Source
pub async fn run_create_schema(
    cmd: BuiltinCommand,
    state: &mut State,
) -> Result<ControlFlow, Error>
Expand description

Register a schema in AWS Glue Schema Registry and stash its version UUID in a testdrive variable.

This keeps a single source of truth in the .td file: define the schema once as a pretty-printed $ set variable, then reference it both here (to register it) and in kafka-ingest (to encode records) — so the body is never written twice.

$ set my-schema={
    "type": "record", "name": "row",
    "fields": [{"name": "a", "type": "long"}]
  }

$ glue-create-schema registry=my-registry name=my-schema set-version-id-var=my-version-id schema=${my-schema}

Arguments:

  • name (required): the schema name.
  • schema (required unless given as the command body): the schema definition. Typically a ${...} reference to a $ set variable.
  • set-version-id-var (optional): testdrive variable to receive the returned SchemaVersionId. Omit when the schema is referenced only by name (e.g. a negative test that registers a schema just to be rejected).
  • registry (optional): registry name. Omit to target Glue’s implicit default registry.
  • data-format (optional, default avro): one of avro, json, protobuf.
  • compatibility (optional, default backward).

If a schema with this name already exists, a new version is registered instead — which is how schema-evolution tests register v2 atop v1.