spring-cloud / spring-cloud-schema-registry

A schema registry implementation for Spring Cloud Stream
47 stars 28 forks source link

Reason for InvalidSchemaException is not returned #22

Closed stoetti closed 4 years ago

stoetti commented 4 years ago

If a schema definition (format avro) is invalid the Schema-Parser throws an Exception containing the invalid part of the definition. This information is not propagated or logged by AvroSchemaValidator. On the client-side the only information that is received is "Bad Request" with the information that the definition is invalid.

In my opinion the response message should contain the message of the SchemaParseException thrown by the parser. This makes it much easier for the client to find the issue of his bad request.

sabbyanandan commented 4 years ago

@stoetti: Thank you for reporting! It makes sense to propagate sufficient information about the problem when it occurs. If the root of the exception is handled inappropriately (or swallowed silently), we will have to fix that.

tzolov commented 4 years ago

Hi @stoetti , would you happen to have an invalid schema sample that reproduces the above explained behavior?

stoetti commented 4 years ago

Hi @stoetti , would you happen to have an invalid schema sample that reproduces the above explained behavior?

Sure

{
  "type": "record",
  "name": "SuperType",
  "namespace": "some.namespace",
  "fields": [
    {
      "name": "field",
      "type": "SomeType"
    }
  ]
}