I am building a microservice piece of software with the API-first approach, I would like to re-use some of the entities in some other microservices. I can generate the object definitions at 3 different places: DTO from the open-api, Entities from JDL but also from the Avro schema.
I created the openAPI definition, from it I can get some DTO generated. Then I described the entities with the JDL file format, my entities allow me to have the structure of my relational database with liquibase. Now I want to use a schema registry AVRO to validate my data structure, from it I could also generate some object definitions.
What is the best practice to generate entities knowing that I would need to share it between different services ?
-- Edit: To my understanding
I could generate the AVRO schema from the entity, push the schema to the registry. Allowing other services to then get the schema and generate the Entities from it.
On service would be 'responsible' of generating the entity+schema from the JDL, and others could retrieve the schema in order to generate the Entity.
Could that be a solution ?