Open karolkalinski opened 9 years ago
Karol take a look at the way you can define the versions in microservice.json file:
{
"prod": {
"this": "foo/bar/registration",
"dependencies": {
"users": {
"path": "foo/bar/users",
"required": true
},
"newsletter": {
"path": "foo/bar/comms/newsletter",
"contentTypeTemplate": "application/vnd.newsletter.$version+json",
"version": "v1"
},
"confirmation": {
"path": "foo/bar/security/confirmation",
"headers": {
"header1": "value1",
"header2": "value2"
}
}
}
}
}
you can define it over there without a need to afterwards use it in the code. Would that suit your purpose better?
Thats it. Thanks
On Thu, Jan 15, 2015 at 1:31 PM, Marcin Grzejszczak < notifications@github.com> wrote:
Karol take a look at the way you can define the versions in microservice.json file:
{ "prod": { "this": "foo/bar/registration", "dependencies": { "users": { "path": "foo/bar/users", "required": true }, "newsletter": { "path": "foo/bar/comms/newsletter", "contentTypeTemplate": "application/vnd.newsletter.$version+json", "version": "v1" }, "confirmation": { "path": "foo/bar/security/confirmation", "headers": { "header1": "value1", "header2": "value2" } } } } }
you can define it over there without a need to afterwards use it in the code. Would that suit your purpose better?
— Reply to this email directly or view it on GitHub https://github.com/4finance/micro-infra-spring/issues/177#issuecomment-70079090 .
The propsed solution with contentTypeTemplate has one issue. If you need more then one microservice.json files then you need to rewrite it to all of them.
You mean there is duplication between various microservice.json
files? Indeed, but it also applies to collaborator names, etc. Any idea how can we reduce duplication among microservice.json
variants?
It may be difficult since the notion of the microservice descriptor was about a microservice from a point of view of a separate codebase. Now assuming that we create a couple of microservices from the same codebase (i.e. via the plugin based approach) then indeed we may end up with needless copy pasting (only naming would differ).
What do you think about creating a gradle task (plugin?) that would take a template of a microservice.json and by providing in some way (maybe via a gradle ext property) the value of that name would produce microservice.json in the resources?
Services with many collaborators may require unnecessary copy/paste of code to create Version class. Look at the code below. Each collaborator would be mapped to such a class. I would vote for creating a solution (a Builder? an abstract class?) that would ease the creation of Content-type header value.