RobertIndie commented on code in PR #18434: URL: https://github.com/apache/pulsar/pull/18434#discussion_r1045569927
########## site2/docs/admin-api-schemas.md: ########## @@ -489,42 +403,92 @@ To get the topic-level schema compatibility check strategy, use one of the follo <TabItem value="Admin CLI"> -Use the [`pulsar-admin topicPolicies get-schema-compatibility-strategy`](/tools/pulsar-admin/) command. +Use the `set-is-allow-auto-update-schema` subcommand. Review Comment: ```suggestion Use the `set-schema-validation-enforce` subcommand. ``` ########## site2/docs/schema-get-started.md: ########## @@ -11,190 +11,291 @@ import TabItem from '@theme/TabItem'; ```` -This hands-on tutorial provides instructions and examples on how to construct and customize schemas. +This hands-on tutorial provides instructions and examples on how to construct schemas. For instructions on administrative tasks, see [Manage schema](admin-api-schemas.md). -## Construct a string schema +## Construct a schema -This example demonstrates how to construct a [string schema](schema-understand.md#primitive-type) and use it to produce and consume messages in Java. +- [Construct a bytes schema](#bytes) +- [Construct a string schema](#string) +- [Construct a key/value schema](#keyvalue) +- [Construct an Avro schema](#avro) +- [Construct a JSON schema](#json) +- [Construct a Protobuf schema](#protobuf) +- [Construct a ProtobufNative schema](#protobufnative) +- [Construct a native Avro schema](#nativeavro) +- [Construct an AUTO_PRODUCE schema](#auto_produce) +- [Construct an AUTO_CONSUME schema](#auto_consume) -1. Create a producer with a string schema and send messages. +### `bytes` Review Comment: ```suggestion ### bytes ``` Seems wired: <img width="250" alt="image" src="https://user-images.githubusercontent.com/16974619/206999532-e4b74a2e-3a43-4db3-b4d8-925c35475264.png"> ########## site2/docs/admin-api-schemas.md: ########## @@ -489,42 +403,92 @@ To get the topic-level schema compatibility check strategy, use one of the follo <TabItem value="Admin CLI"> -Use the [`pulsar-admin topicPolicies get-schema-compatibility-strategy`](/tools/pulsar-admin/) command. +Use the `set-is-allow-auto-update-schema` subcommand. -```shell -pulsar-admin topicPolicies get-schema-compatibility-strategy <topicName> +```bash +bin/pulsar-admin namespaces set-schema-validation-enforce --enable tenant/namespace ``` </TabItem> <TabItem value="REST API"> -Send a `GET` request to this endpoint: {@inject: endpoint|GET|/admin/v2/topics/:tenant/:namespace/:topic|operation/schemaCompatibilityStrategy?version=@pulsar:version_number@} +Send a `POST` request to a namespace endpoint: {@inject: endpoint|POST|/admin/v2/namespaces/:tenant/:namespace/schemaValidationEnforced|operation/schemaValidationEnforced?version=@pulsar:version_number@} + +The post payload is in JSON format. + +```json +{ +“schemaValidationEnforced”: “true” +} +``` </TabItem> <TabItem value="Java Admin API"> +Here is an example to enable schema validation enforcement for a tenant/namespace. + ```java -SchemaCompatibilityStrategy getSchemaCompatibilityStrategy(String topic, boolean applied) +admin.namespaces().setSchemaValidationEnforced("my-namspace", true); ``` -Here is an example of getting the topic-level schema compatibility check strategy. +</TabItem> +</Tabs> +```` -```java -PulsarAdmin admin = …; +### Disable schema validation enforcement -// get the current applied schema compatibility strategy -admin.topicPolicies().getSchemaCompatibilityStrategy("my-tenant/my-ns/my-topic", true); +To disable schema validation enforcement at the **namespace** level, you can use one of the following commands. -// only get the schema compatibility strategy from topic policies -admin.topicPolicies().getSchemaCompatibilityStrategy("my-tenant/my-ns/my-topic", false); +````mdx-code-block +<Tabs groupId="api-choice" + defaultValue="Admin CLI" + values={[{"label":"Admin CLI","value":"Admin CLI"},{"label":"REST API","value":"REST API"},{"label":"Java Admin API","value":"Java Admin API"}]}> + +<TabItem value="Admin CLI"> + +Use the `set-is-allow-auto-update-schema` subcommand. Review Comment: ```suggestion Use the `set-schema-validation-enforce` subcommand. ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
