forked from Microservice-API-Patterns/MDSL-Specification
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHelloHypermediaWorld.mdsl
62 lines (50 loc) · 2.76 KB
/
HelloHypermediaWorld.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
API description SimpleHypermediaAPI
data type HALInstance1 {"someMoreILinkInformation":D<string>}
data type HALInstance2 {"evenMoreILinkInformation":D<string>}
relation type InternalStateTransferLink1 targets HypermediaDrivenEndpoint action continueProcessing input HALInstance1 // DAP (RiP)
relation type InternalStateTransferLink2 targets HypermediaDrivenEndpoint action terminate input HALInstance2 // action: operation or free-form
relation type ExternalStateTransferLink targets external resource at "http://map.mdsl.hateoas/elsewehere"
endpoint type HypermediaDrivenEndpoint
serves as PROCESSING_RESOURCE
exposes
operation initiateProcess with responsibility STATE_CREATION_OPERATION
expecting
payload "in":D<string>
delivering
payload "out":D<int>
links
"transferToStep2": InternalStateTransferLink1
operation continueProcessing with responsibility STATE_TRANSITION_OPERATION
expecting
payload "id2"
delivering
payload {"statusCode":D<int>}
links
"self": InternalStateTransferLink1
"finishProcessing": InternalStateTransferLink2
"goElsewhere": ExternalStateTransferLink
// ** mapping single endpoint to two internal resources
API provider RESTLevel3Provider
offers HypermediaDrivenEndpoint
at endpoint location "http://map.mdsl.hateoas"
via protocol HTTP
static binding
resource Home at "/home"
media type CustomMediaTypeRepresentationJSON as "application/vnd.step2cmt+json"
relation type InternalStateTransferLink1 to {ResourceForStep2, PUT, CustomMediaTypeRepresentationJSON}
operation initiateProcess to POST
// all elements realized as QUERY parameters
// element "in" realized as PATH parameter // OAS/Swagger editor warns if not in URI
element "in" realized as COOKIE parameter // 2nd one and all others ignored (ok)
// element "in" realized as HEADER parameter
// element "in" realized as BODY parameter
// element "in" realized as QUERY parameter // default
accepts CustomMediaTypeRepresentationJSON
replies "application/vnd.restbucks.order-payment+json"
resource ResourceForStep2 at "/home/{id2}"
media type ProcessTerminationInformation as "application/vnd.myHALinstance+json"
relation type InternalStateTransferLink2 to {Home, PUT} // CMT not defined here for GET on "/home/{id}
relation type ExternalStateTransferLink to {"SomeExternalResource", POST, ProcessTerminationInformation}
operation continueProcessing to PUT
element "id2" realized as PATH parameter // OAS/Swagger editor warn if not in URI
// no accepts/replies here (link is enough)