lensesio / schema-registry-ui

Web tool for Avro Schema Registry |
http://lenses.io/product/features
420 stars 112 forks source link

UI says JSON field not valid but the schema works with schema-registry REST API #106

Open j-a-h-i-r opened 3 years ago

j-a-h-i-r commented 3 years ago

Hi, thanks for this cool tool! This makes working with schema-registry easier.

I have noticed an issue during the "Validate" step when trying to create a new subject. My schema is as follows,

{
  "type": "record",
  "name": "evolution",
  "doc": "This is a sample Avro schema to get you started. Please edit",
  "namespace": "com.landoop",
  "fields": [
    {
                "name": "json_field",
                "default": {"identifier": "", "type": ""},
                "type": {
                    "type": "record",
                    "name": "json_field",
                    "fields": [
                        {
                            "type": "string",
                            "name": "identifier"
                        },
                        {
                            "type": "string",
                            "name": "type"
                        }
                    ]
                }
            }
  ]
}

Upon clicking the Validate button, the UI displays is not valid. But if I POST the schema to the schema registry then it works fine.

curl -vs --stderr - -XPOST -i -H "Content-Type: application/vnd.schemaregistry.v1+json" --data '{"schema":"{\"type\":\"record\",\"name\":\"evolution\",\"doc\":\"This is a sample Avro schema to get you started. Please edit\",\"namespace\":\"com.landoop\",\"fields\":[{\"name\":\"json_field\",\"default\":{\"identifier\":\"\",\"type\":\"\"},\"type\":{\"type\":\"record\",\"name\":\"json_field\",\"fields\":[{\"type\":\"string\",\"name\":\"identifier\"},{\"type\":\"string\",\"name\":\"type\"}]}}]}"}' /api/schema-registry/subjects/asdfadsfasdfads/versions