I am trying to register an AVRO schema to Schema Registry. The schema contains a record and some fields. I post the schema as JSON to Schema Registry REST API and although the JSON look fine the server returns curl : {"error_code":42201,"message":"Input schema is an invalid Avro schema"}
.
Could someone please have a look?
Powershell is used to produce the schema as JSON.
$type = @{namespace="customer-actions"; name="customer-enrollment";
type="record";
fields=@{name="id"; type="int"},
@{name="name"; type="string"}}
$typeJ = ConvertTo-Json $type -Depth 3 -Compress
$schema = @{schema = "$typeJ" }
$schemaJ = ConvertTo-Json $schema -Compress
This produces the following...
{"schema":"{\"type\":\"record\",\"namespace\":\"customer-actions\",\"name\":\"customer-enrollment\",\"fields\":[{\"name\":\"id\",\"type\":\"int\
"},{\"name\":\"name\",\"type\":\"string\"}]}"}
Which looks really bad; those escaped quotes are all required. The same escaped characters are used with simpler schema without problems.
Thanks in advance.
[Edit] The call to Schema Registry API if it helps
curl -Uri http://server:8081/subjects/customer-enrollment/versions `
-Method Post `
-ContentType "application/vnd.schemaregistry.v1+json" `
-Body $schemaJ