anthonyikeda commented on issue #20022:
URL: https://github.com/apache/pulsar/issues/20022#issuecomment-1498278882

   Attempted the same with a JSON Schema:
   
   product.schema.json
   
   ```json
   {
       "$schema" : "https://json-schema.org/draft/2020-12/schema";,
       "$id": "http://example.com/product.schema.json";,
       "title" : "Product",
       "description" : "A product in the catalog",
       "type" : "object",
       "properties":{
           "product_id" : {
               "description" : "A unique identifier",
               "type" : "integer"
           },
           "product_name" : {
               "description" : "name of the product",
               "type" : "string"
           },
           "product_description" : {
               "description" : "A description of the product",
               "type" : "string"
           }
       },
       "required": [ "product_id", "product_name"]
   }
   ```
   
   topic-schema-2.json
   
   ```json
   {
       "type" : "JSON",
       "schema" : "{ \"$schema\" : 
\"https://json-schema.org/draft/2020-12/schema\";, \"$id\": 
\"http://example.com/product.schema.json\";, \"title\" : \"Product\", 
\"description\" : \"A product in the catalog\", \"type\" : \"object\", 
\"properties\":{\"product_id\" : {\"description\" : \"A unique identifier\", 
\"type\" : \"integer\" },\"product_name\" : {\"description\" : \"name of the 
product\", \"type\" : \"string\" }, \"product_description\" : { \"description\" 
: \"A description of the product\", \"type\" : \"string\" }  },\"required\": [ 
\"product_id\", \"product_name\"]}"
   }
   ```
   
   Upload schema:
   
   ```bash
   $ bin/pulsar-admin topics create 
persistent://my-tenant/my-namespace/basic-topic-4
   $ bin/pulsar-admin schemas upload -f topic-schema-2.json 
persistent://my-tenant/my-namespace/basic-topic-4
   2023-04-05T14:33:42,660-0700 [AsyncHttpClient-7-1] WARN  
org.apache.pulsar.client.admin.internal.BaseResource - 
[http://localhost:8080/admin/v2/schemas/my-tenant/my-namespace/basic-topic-4/schema]
 Failed to perform http post request: javax.ws.rs.ClientErrorException: HTTP 
422 Invalid schema definition data for JSON schema
   HTTP 422 Invalid schema definition data for JSON schema
   
   Reason: HTTP 422 Invalid schema definition data for JSON schema
   ```


-- 
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]

Reply via email to