schema-registry
schema-registry copied to clipboard
[DGS-4813] Deriving Schema from Messages - JSON
What
- Deriving schema from messages for JSON format.
- Divided into deriving for primitive and oneOfs, records and arrays.
- I haven't added the maven plugin code/mojo code to run from terminal. (Will push it in the next PR)
References
Testing
Unit tests and end to end tests.
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.