Cloud

rpk registry schema get

Get a schema by version, ID, GUID, or by an existing schema.

This returns a lookup of an existing schema or schemas in one of a few potential (mutually exclusive) ways:

  • By version, returning a schema for a required subject and version

  • By ID, returning all subjects using the schema, or filtering for one subject

  • By GUID, returning usages of one schema ID per context, optionally filtered by subject or --schema-context

  • By schema, checking if the schema has been created in the subject

GUID lookup requires Redpanda 26.3 or later. Find GUIDs in the output of rpk registry schema list or rpk registry schema get. Subjects registered only under other IDs holding the same GUID are not included.

To print the schema, use the --print-schema flag.

To print schema metadata properties, use the --print-metadata flag.

The --print-schema and --print-metadata flags are mutually exclusive.

Usage

rpk registry schema get <subject> [flags]

Examples

This section provides examples of how to use rpk registry schema get.

Get version 1 of the schema in subject foo:

rpk registry schema get foo --schema-version 1

Get every subject and version that uses schema ID 3:

rpk registry schema get --id 3

Look up a schema by GUID across contexts:

rpk registry schema get --guid 8b8bd78e-4456-4c99-8d72-64cbe6177dae

Get the usages of a GUID by subject orders-value in context .team:

rpk registry schema get orders-value --guid 8b8bd78e-4456-4c99-8d72-64cbe6177dae --schema-context .team

Check whether the schema in a file is registered in subject foo:

rpk registry schema get foo --schema path/to/file.avro

Print the latest schema of subject foo:

rpk registry schema get foo --schema-version latest --print-schema

Flags

Value Type Description

--deleted

bool

If true, also return deleted schemas.

--guid

string

Schema GUID to look up usages of; subject optional. (New in v26.3.1)

--id

int

ID to lookup schemas usages of; subject optional.

--print-metadata

bool

Print the schema metadata properties; cannot be combined with --print-schema.

--print-schema

bool

Prints the schema in JSON format; cannot be combined with --print-metadata.

--schema

string

Schema file to check existence of. Must be .avro, .json, or .proto. Subject is required.

--schema-version

string

Schema version to lookup (latest, 0, 1…​); subject required.

--type

string

Schema type of the file used to lookup (avro,protobuf,json); overrides schema file extension.

Global flags

Value Type Description

--config

string

Redpanda or rpk config file; default search paths are ~/.config/rpk/rpk.yaml, $PWD/redpanda.yaml, and /etc/redpanda/redpanda.yaml.

-X, --config-opt

stringArray

Override rpk configuration settings; -X help for detail or -X list for terser detail.

--ignore-profile

bool

Ignore rpk.yaml and redpanda.yaml; use default settings.

--profile

string

rpk profile to use.

-v, --verbose

bool

Enable verbose logging.