Skip to content

Improve POST /Groups Validation Feedback #252

@tsteinholz

Description

@tsteinholz

Tested Versions:

  • pravega/schemaregistry:0.2.0
  • pravega/schemaregistry:0.4.0

Problem description

POST: http://{schema registry uri}:9092/v1/groups

{
   "groupName": "mygroup",
   "groupProperties": {
      "serializationFormat":{
         "serializationFormat":"Json"
      },
      "compatibility":{
         "policy":"BackwardTransitive"
      },
      "allowMultipleTypes":false,
      "properties":{ }
   }
}

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.

2022-09-06 17:46:22,042 278827 [RestServer RUNNING] WARN  i.p.s.s.r.r.AbstractResource - Request createGroup failed with exception:  failed with Internal Server error.
java.lang.NullPointerException: null
	at io.pravega.schemaregistry.contract.transform.ModelHelper.decode(ModelHelper.java:65)
	at io.pravega.schemaregistry.contract.transform.ModelHelper.decode(ModelHelper.java:251)
	at io.pravega.schemaregistry.server.rest.resources.GroupResourceImpl.lambda$createGroup$10(GroupResourceImpl.java:138)
	at io.pravega.schemaregistry.server.rest.resources.AbstractResource.lambda$withAuthorization$1(AbstractResource.java:77)
	at java.base/java.util.concurrent.CompletableFuture$UniCompose.tryFire(Unknown Source)
	at java.base/java.util.concurrent.CompletableFuture.postComplete(Unknown Source)
	at java.base/java.util.concurrent.CompletableFuture$AsyncRun.run(Unknown Source)

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions