Forum Discussion

allenoneill's avatar
allenoneill
New Member
7 years ago

Code-gen for Domain Models

Hi - I have a question I cannot find the answer to in documentation, hoping you can assist!

 

I have a project with a number of APIs defined. I also have a number of Domains defined, and I reference models in the domains from the APIs.


My problem/query relates to the code generation from the combination of Model/API.

 

When I generate code (java) from an API, where models are referenced, the API 'pulls' a copy of the domain models locally into the generated code. I understand the logic of this, however, from a production point of view, I don't expect to have multiple copies of domain models spread across each API. Instead, I wanted to do what we would see as standard, which is to make a Java JAR file from the Domain models, and deploy this with the individual API projects as a dependency. This allows us to ensure that each API is using the same version of our shared (domain) models, with no fear of different APIs using different model versions.

 

I am aware that perhaps what I have described above is not 'the way' to use domains, so am open to any suggestions to get to a workable solution.


thanks,


Allen.