Tetap teratur dengan koleksi
Simpan dan kategorikan konten berdasarkan preferensi Anda.
Dokumen ini menunjukkan cara memvalidasi skema untuk topik Pub/Sub.
Pemeriksaan validasi tidak memeriksa kompatibilitas revisi baru dengan revisi lama.
Untuk mendapatkan izin yang Anda perlukan untuk memvalidasi dan mengelola definisi skema,
minta administrator Anda untuk memberi Anda
peran IAM Pub/Sub Editor (roles/pubsub.editor)
di project Anda.
Untuk mengetahui informasi selengkapnya tentang cara memberikan peran, lihat Mengelola akses ke project, folder, dan organisasi.
Peran bawaan ini berisi
izin yang diperlukan untuk memvalidasi definisi skema dan mengelolanya. Untuk melihat izin yang benar-benar diperlukan, luaskan bagian Izin yang diperlukan:
Izin yang diperlukan
Izin berikut diperlukan untuk memvalidasi definisi skema dan mengelolanya:
Buat skema:
pubsub.schemas.create
Lampirkan skema ke topik:
pubsub.schemas.attach
Meng-commit revisi skema:
pubsub.schemas.commit
Menghapus skema atau revisi skema:
pubsub.schemas.delete
Mendapatkan skema atau revisi skema:
pubsub.schemas.get
Anda dapat memberikan peran dan izin kepada entity utama seperti pengguna, grup,
domain, atau akun layanan. Anda dapat membuat skema dalam satu project dan
melampirkannya ke topik yang berada di project lain.
Pastikan Anda memiliki izin yang diperlukan untuk setiap project.
Memvalidasi definisi skema
Anda dapat memvalidasi skema menggunakan
konsolGoogle Cloud , gcloud CLI, Pub/Sub API,
atau Cloud Client Libraries.
Ikuti langkah-langkah yang dibahas di Membuat skema.
Pemeriksaan validasi tidak memeriksa kompatibilitas revisi baru dengan revisi lama.
[[["Mudah dipahami","easyToUnderstand","thumb-up"],["Memecahkan masalah saya","solvedMyProblem","thumb-up"],["Lainnya","otherUp","thumb-up"]],[["Sulit dipahami","hardToUnderstand","thumb-down"],["Informasi atau kode contoh salah","incorrectInformationOrSampleCode","thumb-down"],["Informasi/contoh yang saya butuhkan tidak ada","missingTheInformationSamplesINeed","thumb-down"],["Masalah terjemahan","translationIssue","thumb-down"],["Lainnya","otherDown","thumb-down"]],["Terakhir diperbarui pada 2025-08-19 UTC."],[],[],null,["This 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- Understand how [Pub/Sub schemas work](/pubsub/docs/schemas).\n- [Create a schema](/pubsub/docs/create-schemas).\n\nRequired 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\nRequired 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\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- [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)"]]