Stay organized with collections
Save and categorize content based on your preferences.
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.
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 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.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-23 UTC."],[],[],null,["# Validate schemas definitions\n\nThis document shows you how to validate schemas for Pub/Sub topics.\nThe validation check does not check the compatibility of the new revision\nwith the older revisions.\n\nBefore you begin\n----------------\n\n- Understand how [Pub/Sub schemas work](/pubsub/docs/schemas).\n- [Create a schema](/pubsub/docs/create-schemas).\n\n### Required roles and permissions\n\n\nTo get the permissions that\nyou need to validate schemas definitions and manage them,\n\nask your administrator to grant you the\n\n\n[Pub/Sub Editor](/iam/docs/roles-permissions/pubsub#pubsub.editor) (`roles/pubsub.editor`)\nIAM role on your project.\n\n\nFor more information about granting roles, see [Manage access to projects, folders, and organizations](/iam/docs/granting-changing-revoking-access).\n\n\nThis predefined role contains\n\nthe permissions required to validate schemas definitions and manage them. To see the exact permissions that are\nrequired, expand the **Required permissions** section:\n\n\n#### Required permissions\n\nThe following permissions are required to validate schemas definitions and manage them:\n\n- Create schema: ` ``pubsub.schemas.create`\n- Attach schema to topic: ` ``pubsub.schemas.attach`\n- Commit a schema revision: ` ``pubsub.schemas.commit`\n- Delete a schema or a schema revision: ` ``pubsub.schemas.delete`\n- Get a schema or schema revisions: ` ``pubsub.schemas.get`\n- List schemas: ` ``pubsub.schemas.list`\n- List schema revisions: ` ``pubsub.schemas.listRevisions`\n- Rollback a schema: ` ``pubsub.schemas.rollback`\n- Validate a message: ` ``pubsub.schemas.validate`\n- Get the IAM policy for a schema: ` ``pubsub.schemas.getIamPolicy`\n- Configure the [IAM policy](/iam/docs/reference/rest/v1/Policy) for a schema: ` ``pubsub.schemas.setIamPolicy`\n\n\nYou might also be able to get\nthese permissions\nwith [custom roles](/iam/docs/creating-custom-roles) or\nother [predefined roles](/iam/docs/roles-overview#predefined).\n\nYou can grant roles and permissions to principals such as users, groups,\ndomains, or service accounts. You can create a schema in one project and\nattach it to a topic located in a different project.\nEnsure that you have the required permissions for\neach project.\n\nValidate a schema definition\n----------------------------\n\nYou can validate a schema by using the\nGoogle Cloud console, the gcloud CLI, the Pub/Sub API,\nor the Cloud Client Libraries.\n\nFollow the steps discussed in [Create a schema](/pubsub/docs/create-schemas).\n\nThe validation check does not check the compatibility of the new revision\nwith the older revisions.\n\nWhat's next\n-----------\n\n- [Validate a message for a schema](/pubsub/docs/validate-schema-message)\n\n- [Publish messages to a topic with a schema](/pubsub/docs/publish-topics-schema)"]]