-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve POST /Groups Validation Feedback #252
Comments
I found the error was coming from the following line of code throwing an IllegalArgumentException with no message in it. Resulting in the "null. {}" message being returned to the user. Preconditions.checkArgument(isValidCompatibilityForFormat(groupProperties.getSerializationFormat(), groupProperties.getCompatibility())); The source of this issue seems to be the inconsistent usage of the private boolean isValidCompatibilityForFormat(SerializationFormat serializationFormat, Compatibility compatibility) {
switch (serializationFormat) {
case Avro:
return true;
case Protobuf:
// Only Allow Any or Deny All are allowed values.
case Json:
// Only Allow Any or Deny All are allowed values.
case Custom:
// Only Allow Any or Deny All are allowed values.
case Any:
return compatibility.getType().equals(Compatibility.Type.AllowAny) || compatibility.getType().equals(Compatibility.Type.DenyAll);
default:
throw new IllegalArgumentException("Unknown serialization format");
}
} src: schema-registry/server/src/main/java/io/pravega/schemaregistry/service/SchemaRegistryService.java Line 647 in 0072abf
It is documented to return a boolean if the schema is valid, however, it also throws an IllegalArgumentException with a description. Since the method is being called inside of a In the case that the Once I was able to figure out why I was getting an HTTP 400 error, updating the compatibility type to "AllowAll" fixed my issue in this case, where the following provided me a HTTP 201 return.
This would be extremely helpful to have documented in the
I will leave this issue open to associate an improvement PR to these suggestions. |
@tsteinholz, thank you for the input. We will have a look on this and will work accordingly. |
Tested Versions:
Problem description
POST: http://{schema registry uri}:9092/v1/groups
HTTP 400 Error when creating a group using the "Json" serialization format. Server Output:
[grizzly-http-server-0] WARN i.p.s.s.r.r.AbstractResource - Bad argument for request createGroup failed with exception: . null. {}
HTTP 500 Error when creating a group with a "JSON" or "json" serialization format.
Problem location
API Rest Controller for Groups (POST), possibility the
i.p.s.s.r.r.AbstractResource
.Suggestions for an improvement
The user gets no feedback in the HTTP return as to what happened, only the return code. There is an unhandled exception when using invalid serialization formats and it is not clear to me if the schema registry is able to create schemas with the JSON serialization format or if there is another validation error preventing the group from being defined.
The current payload is based of the (invalid) example provided here https://pravega.io/docs/snapshot/schema-registry/rest-usage
The text was updated successfully, but these errors were encountered: