You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by li...@apache.org on 2023/03/09 07:07:42 UTC
[pulsar-site] branch main updated: explain the schema format for REST API & Java Admin API (#460)
This is an automated email from the ASF dual-hosted git repository.
liuyu pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/pulsar-site.git
The following commit(s) were added to refs/heads/main by this push:
new 91430cdcc7d explain the schema format for REST API & Java Admin API (#460)
91430cdcc7d is described below
commit 91430cdcc7d469cfe5ab84eedc5342ab121ac522
Author: Julien Jakubowski <ju...@streamnative.io>
AuthorDate: Thu Mar 9 08:07:37 2023 +0100
explain the schema format for REST API & Java Admin API (#460)
---
docs/admin-api-schemas.md | 43 +++++++++++++++++++++++--------------------
1 file changed, 23 insertions(+), 20 deletions(-)
diff --git a/docs/admin-api-schemas.md b/docs/admin-api-schemas.md
index bc583a1288f..deb43cd2102 100644
--- a/docs/admin-api-schemas.md
+++ b/docs/admin-api-schemas.md
@@ -51,26 +51,6 @@ The `schema-definition-file` is in JSON format.
}
```
-The `schema-definition-file` includes the following fields:
-
-| Field | Description |
-| --- | --- |
-| `type` | The schema type. |
-| `schema` | The schema definition data, which is encoded in UTF 8 charset. <li>If the schema is a **primitive** schema, this field should be blank. </li><li>If the schema is a **struct** schema, this field should be a JSON string of the Avro schema definition. </li> |
-| `properties` | The additional properties associated with the schema. |
-
-The following is an example of the `schema-definition-file` for a JSON schema.
-
-**Example**
-
-```json
-{
- "type": "JSON",
- "schema": "{\"type\":\"record\",\"name\":\"User\",\"namespace\":\"com.foo\",\"fields\":[{\"name\":\"file1\",\"type\":[\"null\",\"string\"],\"default\":null},{\"name\":\"file2\",\"type\":[\"null\",\"string\"],\"default\":null},{\"name\":\"file3\",\"type\":[\"string\",\"null\"],\"default\":\"dfdf\"}]}",
- "properties": {}
-}
-```
-
</TabItem>
<TabItem value="REST API">
@@ -105,10 +85,33 @@ payload.setSchema("");
admin.createSchema("my-tenant/my-ns/my-topic", payload);
```
+If the schema is a **primitive** schema, the `schema` field must be blank.
+If the schema is a **struct** schema, this field must be a JSON string of the Avro schema definition.
+
</TabItem>
</Tabs>
````
+The payload includes the following fields:
+
+| Field | Description |
+| --- | --- |
+| `type` | The schema type. |
+| `schema` | The schema definition data, which is encoded in UTF 8 charset. <li>If the schema is a **primitive** schema, this field should be blank. </li><li>If the schema is a **struct** schema, this field should be a JSON string of the Avro schema definition. </li> |
+| `properties` | The additional properties associated with the schema. |
+
+The following is an example for a JSON schema.
+
+**Example**
+
+```json
+{
+ "type": "JSON",
+ "schema": "{\"type\":\"record\",\"name\":\"User\",\"namespace\":\"com.foo\",\"fields\":[{\"name\":\"file1\",\"type\":[\"null\",\"string\"],\"default\":null},{\"name\":\"file2\",\"type\":[\"null\",\"string\"],\"default\":null},{\"name\":\"file3\",\"type\":[\"string\",\"null\"],\"default\":\"dfdf\"}]}",
+ "properties": {}
+}
+```
+
### Get the latest schema
To get the latest schema for a topic, you can use one of the following methods.