This document shows you how to validate schemas for Pub/Sub topics. The validation check does not check the compatibility of the new revision with the older revisions.
Before you begin
- Understand how Pub/Sub schemas work.
- Create a schema.
Required roles and permissions
To get the permissions that you need to validate schemas definitions and manage them,
ask your administrator to grant you the
Pub/Sub Editor (roles/pubsub.editor
) IAM role on your project.
For more information about granting roles, see Manage access to projects, folders, and organizations.
This predefined role contains the permissions required to validate schemas definitions and manage them. To see the exact permissions that are required, expand the Required permissions section:
Required permissions
The following permissions are required to validate schemas definitions and manage them:
-
Create schema:
pubsub.schemas.create
-
Attach schema to topic:
pubsub.schemas.attach
-
Commit a schema revision:
pubsub.schemas.commit
-
Delete a schema or a schema revision:
pubsub.schemas.delete
-
Get a schema or schema revisions:
pubsub.schemas.get
-
List schemas:
pubsub.schemas.list
-
List schema revisions:
pubsub.schemas.listRevisions
-
Rollback a schema:
pubsub.schemas.rollback
-
Validate a message:
pubsub.schemas.validate
-
Get the IAM policy for a schema:
pubsub.schemas.getIamPolicy
-
Configure the IAM policy for a schema:
pubsub.schemas.setIamPolicy
You might also be able to get these permissions with custom roles or other predefined roles.
You can grant roles and permissions to principals such as users, groups, domains, or service accounts. You can create a schema in one project and attach it to a topic located in a different project. Ensure that you have the required permissions for each project.
Validate a schema definition
You can validate a schema by using the Google Cloud console, the gcloud CLI, the Pub/Sub API, or the Cloud Client Libraries.
Follow the steps discussed in Create a schema.
The validation check does not check the compatibility of the new revision with the older revisions.