-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathDataTypeModelingExamples.mdsl
68 lines (57 loc) · 3.32 KB
/
DataTypeModelingExamples.mdsl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
API description SampleAPI
data type Opaque P
data type Opaque2 "Opaque"
data type Opaque3 "OPaque":P
data type Null D<void> // default if only D is specified (or string?)
data type ByteArray D<raw>
data type SampleDTO1 {Identifier, Data, Metadata, Link}
data type SampleDTO2 {ID, D, MD, L}
data type SampleAPL1 (D, D<int>, "a":D, "b":D<bool>)
data type SampleAPL2 ("a":Data, "b":Data, Data, Data<int>)
data type VersionedDataType version "0.0.1" {ID, P}
data type HTTPHeaders HTTPHeader*
data type HTTPHeader {"key":D<string>, "value":D<string>}
data type HTTPHeader2 {"key":HTTPHeaderEnum, "value":D<string>} // not supporting custom headers this way
data type HTTPHeaderEnum { "User-Agent" | "Content-Type" /* etc., see https://en.wikipedia.org/wiki/List_of_HTTP_header_fields */ }
data type HTTPStatusCode {"code":HTTPStatusCodeEnum, "text": HTTPStatusTextEnum} // could replace ", " with "|"?
data type HTTPStatusCodeEnum { "200" | "400" /* etc., see https://en.wikipedia.org/wiki/List_of_HTTP_status_codes */ }
data type HTTPStatusTextEnum { "OK" | "Bad Request" /* etc., see https://en.wikipedia.org/wiki/List_of_HTTP_status_codes */ }
// data type StatusAndErrorInformation P
data type SampleOperationErrorResponse {HTTPStatusCodeEnum, <<Error_Report>>{"errorMessage": D<string>|"errorObject":P}}
data type SomeUnspecifiedEntity <<Entity>>D
data type DTO <<Entity>>{"field1":D<int>, "field2":D<string>}
data type DTOWithLinks <<Entity>>{"field1":D<int>, "field2":D<string>, "references":L<string>*}
data type SampleOperationRequestData {"someTextData":D<string> | "someCounter": D<int>} // either text or number (choice on tree level)
data type SampleOperationResponseData {"someMetadata":MD<string>, "someText":D<string>, "someDataTransferObject":DTOWithLinks}
data type TestType <<Entity>> "name":D<double>
data type ChoiceDemo {"optionA":D|"optionB":D}
data type AnIntegerOrAString (D<int> | D<string>)
endpoint type MostBasicPortContract version "0.0.1"
exposes operation sampleOperation
expecting payload P // P is an abstract/unspecified parameter placeholder
structured as MAP_TYPE // default, so not specified everywhere
delivering payload P
structured as MAP_TYPE
endpoint type PartialPortContract
exposes operation sampleOperation
expecting payload {"someData", D<int>, ID} // three atomic parameters: first one only has a name, second one has role and type, third one has role only
delivering payload {"someMetadata":MD, "someText":D<string>, "someDataTransferObject":DTO}
endpoint type PartialPortContractVersioned
exposes operation sampleOperation version "0.0.1" with responsibility EVENT_PROCESSOR
expecting payload {"someData", D<int>, ID} // three atomic parameters: first one only has a name, second one has role and type, third one has role only
delivering payload VersionedDataType
endpoint type ElaboratePortContract
exposes operation sampleOperation
expecting
payload SampleOperationRequestData
delivering
payload SampleOperationResponseData
endpoint type ElaboratePortContractWithErorInformation
exposes operation sampleOperation
expecting
headers HTTPHeaders
payload SampleOperationRequestData
delivering
headers {HTTPStatusCodeEnum, HTTPHeaders}
payload {SampleOperationErrorResponse | SampleOperationResponseData}
IPA