schema-registry icon indicating copy to clipboard operation
schema-registry copied to clipboard

[DGS-4813] Deriving Schema from Messages - JSON

Open jshahc opened this issue 2 years ago • 1 comments

What

  1. Deriving schema from messages for JSON format.
  2. Divided into deriving for primitive and oneOfs, records and arrays.
  3. I haven't added the maven plugin code/mojo code to run from terminal. (Will push it in the next PR)

References

One pager FF ticket

Testing

Unit tests and end to end tests.

jshahc avatar Sep 13 '22 12:09 jshahc

We could improve the class design. In this PR, the Mojo class calls a static DeriveSchema which calls a static DeriveJsonSchema. For instance you could take a look at how existing SR code is structured. Check the relationships between AvroMessageReader, SchemaMessageReader, AvroSchemaProvider, AbstractSchemaProvider, SchemaProvider, AvroSchema, ParsedSchema

I've made DeriveSchema an abstract class to have common functions defined in it like getPrimitiveSchema and other necessary ones like getSchemaForArray as abstract. So, this DeriveSchema would be extended by deriveJsonSchema, deriveAvroSchema and deriveProtobufSchema. Now, only the Utils classes have static functions.

jshahc avatar Sep 21 '22 14:09 jshahc