|
19 | 19 | #
|
20 | 20 | # derived from https://github.com/verisign/python-confluent-schemaregistry.git
|
21 | 21 | #
|
22 |
| -import json |
23 | 22 | import logging
|
24 | 23 | import warnings
|
25 | 24 | from collections import defaultdict
|
@@ -213,7 +212,7 @@ def register(self, subject, avro_schema):
|
213 | 212 | url = '/'.join([self.url, 'subjects', subject, 'versions'])
|
214 | 213 | # body is { schema : json_string }
|
215 | 214 |
|
216 |
| - body = {'schema': json.dumps(avro_schema.to_json())} |
| 215 | + body = {'schema': str(avro_schema)} |
217 | 216 | result, code = self._send_request(url, method='POST', body=body)
|
218 | 217 | if (code == 401 or code == 403):
|
219 | 218 | raise ClientError("Unauthorized access. Error code:" + str(code))
|
@@ -253,7 +252,7 @@ def check_registration(self, subject, avro_schema):
|
253 | 252 | url = '/'.join([self.url, 'subjects', subject])
|
254 | 253 | # body is { schema : json_string }
|
255 | 254 |
|
256 |
| - body = {'schema': json.dumps(avro_schema.to_json())} |
| 255 | + body = {'schema': str(avro_schema)} |
257 | 256 | result, code = self._send_request(url, method='POST', body=body)
|
258 | 257 | if code == 401 or code == 403:
|
259 | 258 | raise ClientError("Unauthorized access. Error code:" + str(code))
|
@@ -374,7 +373,7 @@ def get_version(self, subject, avro_schema):
|
374 | 373 | return version
|
375 | 374 |
|
376 | 375 | url = '/'.join([self.url, 'subjects', subject])
|
377 |
| - body = {'schema': json.dumps(avro_schema.to_json())} |
| 376 | + body = {'schema': str(avro_schema)} |
378 | 377 |
|
379 | 378 | result, code = self._send_request(url, method='POST', body=body)
|
380 | 379 | if code == 404:
|
@@ -402,7 +401,7 @@ def test_compatibility(self, subject, avro_schema, version='latest'):
|
402 | 401 | """
|
403 | 402 | url = '/'.join([self.url, 'compatibility', 'subjects', subject,
|
404 | 403 | 'versions', str(version)])
|
405 |
| - body = {'schema': json.dumps(avro_schema.to_json())} |
| 404 | + body = {'schema': str(avro_schema)} |
406 | 405 | try:
|
407 | 406 | result, code = self._send_request(url, method='POST', body=body)
|
408 | 407 | if code == 404:
|
|
0 commit comments