Skip to content

Commit f035e68

Browse files
authored
Feature/mdsl enhancements (#70)
* MDSL keyword updates & start from port 8000 instead of 8080 * MDSL generator: support parameter trees out of entities & use cardinalities for collection types
1 parent d5150d7 commit f035e68

23 files changed

+710
-47
lines changed

org.contextmapper.dsl.tests/integ-test-files/mdsl/basic-mdsl-model-test.mdsl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ data type Address P
44
data type Parameter1Type P
55
data type Parameter2Type P
66
data type ReturnType P
7-
data type anotherMethodParameter ( Parameter1Type, Parameter2Type )
7+
data type anotherMethodParameter { "param1":Parameter1Type, "param2":Parameter2Type }
88

9-
endpoint contract type Customers
9+
endpoint type Customers
1010
exposes
1111
operation updateAddress
1212
expecting
@@ -19,7 +19,7 @@ endpoint contract type Customers
1919

2020
API provider CustomerManagementContext
2121
offers Customers
22-
at endpoint instance location "http://localhost:8080"
22+
at endpoint location "http://localhost:8000"
2323
via protocol "RESTful HTTP"
2424

2525
API client ContractManagementContext
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
ContextMap {
2+
contains CustomerManagementContext, ContractManagementContext, JustAnotherContext
3+
4+
CustomerManagementContext -> ContractManagementContext {
5+
exposedAggregates = Customers
6+
implementationTechnology = "RESTful HTTP"
7+
}
8+
9+
// this relationship must be ignored, because it has no exposedAggregates
10+
CustomerManagementContext -> JustAnotherContext
11+
12+
// duplicate relationship should not change the result
13+
CustomerManagementContext -> ContractManagementContext {
14+
exposedAggregates = Customers
15+
}
16+
17+
}
18+
19+
BoundedContext ContractManagementContext
20+
21+
BoundedContext CustomerManagementContext {
22+
23+
Aggregate Customers {
24+
Entity Customer {
25+
aggregateRoot
26+
27+
def ReturnType updateAddress(Address address);
28+
def void anotherMethod(Parameter1Type param1, List<Parameter2Type> param2);
29+
}
30+
}
31+
}
32+
33+
BoundedContext JustAnotherContext
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
API description CustomerManagementContextAPI
2+
3+
data type Address P
4+
data type Parameter1Type P
5+
data type Parameter2Type P
6+
data type ReturnType P
7+
data type anotherMethodParameter { "param1":Parameter1Type, "param2":Parameter2Type* }
8+
9+
endpoint type Customers
10+
exposes
11+
operation updateAddress
12+
expecting
13+
payload Address
14+
delivering
15+
payload ReturnType
16+
operation anotherMethod
17+
expecting
18+
payload anotherMethodParameter
19+
20+
API provider CustomerManagementContext
21+
offers Customers
22+
at endpoint location "http://localhost:8000"
23+
via protocol "RESTful HTTP"
24+
25+
API client ContractManagementContext
26+
consumes Customers
27+
28+
IPA
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
ContextMap {
2+
contains CustomerManagementContext, ContractManagementContext, JustAnotherContext
3+
4+
CustomerManagementContext -> ContractManagementContext {
5+
exposedAggregates = Customers
6+
implementationTechnology = "RESTful HTTP"
7+
}
8+
9+
// this relationship must be ignored, because it has no exposedAggregates
10+
CustomerManagementContext -> JustAnotherContext
11+
12+
// duplicate relationship should not change the result
13+
CustomerManagementContext -> ContractManagementContext {
14+
exposedAggregates = Customers
15+
}
16+
17+
}
18+
19+
BoundedContext ContractManagementContext
20+
21+
BoundedContext CustomerManagementContext {
22+
23+
Aggregate Customers {
24+
Entity Customer {
25+
aggregateRoot
26+
27+
def List<ReturnType> updateAddress(Address address);
28+
def void anotherMethod(Parameter1Type param1, List<Parameter2Type> param2);
29+
}
30+
}
31+
}
32+
33+
BoundedContext JustAnotherContext
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
API description CustomerManagementContextAPI
2+
3+
data type Address P
4+
data type Parameter1Type P
5+
data type Parameter2Type P
6+
data type ReturnType P
7+
data type anotherMethodParameter { "param1":Parameter1Type, "param2":Parameter2Type* }
8+
9+
endpoint type Customers
10+
exposes
11+
operation updateAddress
12+
expecting
13+
payload Address
14+
delivering
15+
payload ReturnType*
16+
operation anotherMethod
17+
expecting
18+
payload anotherMethodParameter
19+
20+
API provider CustomerManagementContext
21+
offers Customers
22+
at endpoint location "http://localhost:8000"
23+
via protocol "RESTful HTTP"
24+
25+
API client ContractManagementContext
26+
consumes Customers
27+
28+
IPA
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
ContextMap {
2+
contains CustomerManagementContext, ContractManagementContext, JustAnotherContext
3+
4+
CustomerManagementContext -> ContractManagementContext {
5+
exposedAggregates = Customers
6+
implementationTechnology = "RESTful HTTP"
7+
}
8+
9+
// this relationship must be ignored, because it has no exposedAggregates
10+
CustomerManagementContext -> JustAnotherContext
11+
12+
// duplicate relationship should not change the result
13+
CustomerManagementContext -> ContractManagementContext {
14+
exposedAggregates = Customers
15+
}
16+
17+
}
18+
19+
BoundedContext ContractManagementContext
20+
21+
BoundedContext CustomerManagementContext {
22+
23+
Aggregate Customers {
24+
Entity Customer {
25+
aggregateRoot
26+
27+
String firstName
28+
String lastName
29+
- Address address
30+
BankAccount account
31+
32+
def ReturnType updateCustomer(List<@Customer> customer);
33+
}
34+
35+
Entity Address {
36+
String street
37+
int houseNumber
38+
}
39+
}
40+
}
41+
42+
BoundedContext JustAnotherContext
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
API description CustomerManagementContextAPI
2+
3+
data type BankAccount P
4+
data type Customer { "firstName":V<string>, "lastName":V<string>, "account":BankAccount, "address":{ "street":V<string>, "houseNumber":V<int> } }
5+
data type ReturnType P
6+
7+
endpoint type Customers
8+
exposes
9+
operation updateCustomer
10+
expecting
11+
payload Customer*
12+
delivering
13+
payload ReturnType
14+
15+
API provider CustomerManagementContext
16+
offers Customers
17+
at endpoint location "http://localhost:8000"
18+
via protocol "RESTful HTTP"
19+
20+
API client ContractManagementContext
21+
consumes Customers
22+
23+
IPA
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
ContextMap {
2+
contains CustomerManagementContext, ContractManagementContext, JustAnotherContext
3+
4+
CustomerManagementContext -> ContractManagementContext {
5+
exposedAggregates = Customers
6+
implementationTechnology = "RESTful HTTP"
7+
}
8+
9+
// this relationship must be ignored, because it has no exposedAggregates
10+
CustomerManagementContext -> JustAnotherContext
11+
12+
// duplicate relationship should not change the result
13+
CustomerManagementContext -> ContractManagementContext {
14+
exposedAggregates = Customers
15+
}
16+
17+
}
18+
19+
BoundedContext ContractManagementContext
20+
21+
BoundedContext CustomerManagementContext {
22+
23+
Aggregate Customers {
24+
Entity Customer {
25+
aggregateRoot
26+
27+
String firstName
28+
String lastName
29+
- Address address
30+
BankAccount account
31+
32+
def ReturnType updateCustomer(@Customer customer, JustSomeParameterType param2);
33+
}
34+
35+
Entity Address {
36+
String street
37+
int houseNumber
38+
}
39+
}
40+
}
41+
42+
BoundedContext JustAnotherContext
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
API description CustomerManagementContextAPI
2+
3+
data type BankAccount P
4+
data type JustSomeParameterType P
5+
data type ReturnType P
6+
data type updateCustomerParameter { "customer":{ "firstName":V<string>, "lastName":V<string>, "account":BankAccount, "address":{ "street":V<string>, "houseNumber":V<int> } }, "param2":JustSomeParameterType }
7+
8+
endpoint type Customers
9+
exposes
10+
operation updateCustomer
11+
expecting
12+
payload updateCustomerParameter
13+
delivering
14+
payload ReturnType
15+
16+
API provider CustomerManagementContext
17+
offers Customers
18+
at endpoint location "http://localhost:8000"
19+
via protocol "RESTful HTTP"
20+
21+
API client ContractManagementContext
22+
consumes Customers
23+
24+
IPA
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
ContextMap {
2+
contains CustomerManagementContext, ContractManagementContext, JustAnotherContext
3+
4+
CustomerManagementContext -> ContractManagementContext {
5+
exposedAggregates = Customers
6+
implementationTechnology = "RESTful HTTP"
7+
}
8+
9+
// this relationship must be ignored, because it has no exposedAggregates
10+
CustomerManagementContext -> JustAnotherContext
11+
12+
// duplicate relationship should not change the result
13+
CustomerManagementContext -> ContractManagementContext {
14+
exposedAggregates = Customers
15+
}
16+
17+
}
18+
19+
BoundedContext ContractManagementContext
20+
21+
BoundedContext CustomerManagementContext {
22+
23+
Aggregate Customers {
24+
Entity Customer {
25+
aggregateRoot
26+
27+
String firstName
28+
String lastName
29+
- Address address
30+
BankAccount account
31+
32+
def ReturnType updateCustomer(@Customer customer);
33+
}
34+
35+
Entity Address {
36+
String street
37+
int houseNumber
38+
- DeepEntity deepAttr
39+
}
40+
41+
Entity DeepEntity {
42+
String justSomeDeepAttribute
43+
}
44+
}
45+
}
46+
47+
BoundedContext JustAnotherContext

0 commit comments

Comments
 (0)