ContextMapper/context-mapper-dsl

Comment of Domain Object do not work

Opened this issue · 2 comments

@stefan-ka hello
For library, getComment(SL_COMMENT and ML_COMMENT) on Bounded Context and Domain Object do not work, return null.

Below, getComment not work

 /*Custormer entity displayName*/
BoundedContext CustomerSelfServiceContext{
    Aggregate CustomerFrontend { // Customer Agg displayName
		Entity CustomerAddressChange {
			aggregateRoot
			- UserAccount issuer
			- Address changedAddress
		}
    }
}

model.getBoundedContexts().forEach(bc -> {
            System.out.println(bc.getComment());
            bc.getAggregates().forEach(aggregate -> {
                System.out.println(aggregate.getComment());
            });
        });

output: null null ...

Hi @smilucky

Thanks for reporting the issue! I am aware of that, but as far as I know its an Xtext issue (or feature, I'm not sure) we cannot really solve on our side. Comments (SL_COMMENT and ML_COMMENT) can be added to the grammar, but their content is not parsed and filled into the Ecore model. But I can check whether something changed here since I last stumbled over that one.

We also had this issue when we wanted to add decorators for our MDSL generator. We then solved it by adding a "doc" string on top of the Aggregate. An example can be found here: https://contextmapper.org/docs/mdsl/#microservice-api-patterns-map-decorators
This is however not available on all our objects (also not the Bounded Context).

What exactly is your use case? Could the example above be a workaround for you as well?

Best regards,
Stefan

Hi @stefan-ka

Thank you very much for your response. I tried the solution you suggested (using doc), and it solved 99% of my problem. My use case involves adding additional information to CML elements, such as names, descriptions, unsupported data types in CML, object relationships, etc.