EMD->EML generation bug: Should not require additional readmodel property in EMD
In the current version there needs to be at least one read model parameter which is not an aggregate ID in order for the EMD->EML converter to be able to find the events a read model needs to subscribe to:
This is OK:
# test
Register -> userId, name
User Registration Happened // userId, name
Submit -> timesheetId
Timesheet Submitted // timesheetId
Timesheets* // timesheetId, userId, name
This should be OK, but isn't:
# test
Register -> userId, name
User Registration Happened // userId, name
Submit -> timesheetId
Timesheet Submitted // timesheetId
Timesheets* // timesheetId, userId
les validate results in:
EML Errors:
MissingReadmodelSubscribesToEvent: test-Timesheets: Missing Readmodel SubscribesTo Event(s)
There is no need for this limitation - EMD->EML should be able to find the "Timesheet Submitted" and "User Registration Happened" events based on the EMD supplied.
It may be more of a question to understand the problem a bit better:
should Timesheets subscribe to both User Registration Happened and Timesheet Submitted?
I was trying to debug this with the following input:
# test
Register -> userId, name
User Registration Happened // userId, name
Submit -> timesheetId
Timesheet Submitted // timesheetId
Timesheets* // timesheetId, userId, name
But if I log the readmodel, it seems that User Registration Happened it the only one it subscribes to.
My logging(log.Printf("%v", readmodel)) is in this loop: https://github.com/Adaptech/les/blob/master/pkg/eml/validateReadmodels.go#L8
The output:
2018/05/20 20:04:50 {{Timesheets timesheetId [UserRegistrationHappened]}}
2018/05/20 20:04:50 {{Timesheets timesheetId [UserRegistrationHappened]}}