You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+5-7Lines changed: 5 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -18,25 +18,23 @@ This is the "hello world" of cross-platform service contracting, specified in MD
18
18
~~~
19
19
API description HelloWorldAPI
20
20
21
-
data type SampleDTO {ID, D}
21
+
data type SampleDTO {ID, "someData": D<string>}
22
22
23
23
endpoint type HelloWorldEndpoint
24
24
exposes
25
25
operation sayHello
26
26
expecting payload D<string>
27
27
delivering payload SampleDTO
28
28
29
-
API provider HelloWorldAPIProvider1
30
-
offers HelloWorldEndpoint
31
-
32
-
API client HelloWorldAPIClient1
33
-
consumes HelloWorldEndpoint
29
+
API provider HelloWorldAPIProvider
30
+
offers HelloWorldEndpoint at endpoint location "http://localhost:8080"
31
+
via protocol HTTP binding resource Home at "/hello"
34
32
~~~
35
33
36
34
As the example shows, the MDSL grammar defines two related specification languages:
37
35
38
36
1. An *API description language*: API `endpoints type`s (a.k.a. service contracts types) can be defined, including their operations; API client and providers of instances of these endpoint types can be specified elaborately, including Service Level Agreements (SLAs).
39
-
2. A *data contract language* providing a type system for DTRs in request and response messages (which is very compact): `data type SampleDTO {ID, D}`.
37
+
2. A *data contract language* providing a type system for DTRs in request and response messages (which is very compact): `data type SampleDTO {ID, "someData": D<string>}`. This type definition pairs an ID (without a name) with some string data.
40
38
41
39
These two languages can be used independently of each other; for instance, data contracts for operations in contract types can also be specified in JSON Schema (or XML Schema). Specifications do not have to be complete to be useful (e.g., in early stages of service design); tools will be expected to check that, use defaults, etc.
Copy file name to clipboardExpand all lines: docs/flows.md
+18-8Lines changed: 18 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -9,7 +9,7 @@ copyright: Olaf Zimmermann, 2021. All rights reserved.
9
9
Orchestration Flows
10
10
===================
11
11
12
-
_Note:_ The status of the language concepts specified here is [*Experimental Preview*](https://microservice-api-patterns.org/patterns/evolution/ExperimentalPreview.html). Concepts and their tool support might still change in future versions of MDSL.
12
+
_Note:_ The status of the language concepts specified here is [*Experimental Preview*](https://microservice-api-patterns.org/patterns/evolution/ExperimentalPreview.html). Concepts and their tool support have been validated, for instance via code generation to multiple target languages (see below). They are rather stable now; many examples and test cases exist. However, they might still change in future versions of MDSL.
13
13
14
14
## Use Cases (When to Specify)
15
15
@@ -22,12 +22,14 @@ _Note:_ The status of the language concepts specified here is [*Experimental Pre
22
22
<!--
23
23
Early "E-SOAD":
24
24
25
-
* Application flows in inside a service
25
+
* Application flows inside a service
26
26
* Service orchestration, API operation call sequencing
27
27
* EIP-style integration flows (asynch., pipes and filters)
28
28
* Testing (mocking, staging)
29
29
-->
30
30
31
+
*News (Jan 13, 2022)*: The blog post and demo script ["Event-Driven Service Design: Five Steps from Event Storming to OpenAPI and Camel Flow"](https://ozimmer.ch/practices/2022/01/13/EventDrivenServiceDesignDemo.html) features the MDSL flow modeling concepts in action.
32
+
31
33
## Simple Flow Steps
32
34
33
35
The following basic flow was generated from the [sample story scenario](./scenarios) with one of the quick fix [transformations](./soad.md) in the [MDSL tools](./tools.md):
Copy file name to clipboardExpand all lines: docs/generators/graphql.md
+33-12Lines changed: 33 additions & 12 deletions
Original file line number
Diff line number
Diff line change
@@ -17,10 +17,10 @@ In Eclipse, the generator resides in the MDSL context menu:
17
17
18
18
<ahref="./.../../media/eclipse-graphql-generator-context-menu.png"></a>
19
19
20
-
If you work with the CLI, the following command generates the GraphQL specification:
20
+
The following CLI command generates the GraphQL specification:
21
21
22
22
```bash
23
-
./mdsl -i model.mdsl -g graphql
23
+
mdsl -i model.mdsl -g graphql
24
24
```
25
25
26
26
_Hint:_ Both tools generate the Graphql file into the `src-gen` folder which is located in the projects root directory (Eclipse) or the directory from which the `mdsl` command has been called (CLI). Both tools create the directory automatically in case it does not already exist.
@@ -149,7 +149,7 @@ To validate whether the generated `*.graphql` file, many IDE plugins/extensions
149
149
*[GraphQL extensions for Visual Studio Code](https://marketplace.visualstudio.com/items?itemName=GraphQL.vscode-graphql)
150
150
*[graphqleditor.com](https://graphqleditor.com/)
151
151
152
-
The [graphqleditor.com](https://graphqleditor.com/)online tool provides an editor that compiles the schema and features a graphical representation of the model (a login/account might be required):
152
+
[graphqleditor.com](https://graphqleditor.com/) provides an editor that compiles the schema and features a graphical representation of the model (an account might be required):
Finally, you just have to implement some resolvers that actually return some data. For our example above, we implemented the following resolver that answers the _lookupPapersFromAuthor_ query:
226
+
Finally, implement some resolvers that actually return some data. For our example above, we implemented the following resolver that answers the _lookupPapersFromAuthor_ query:
227
227
228
228
```js
229
229
constpapers= {
@@ -309,7 +309,7 @@ mutation createPaper {
309
309
**Note:** The mutation implementation just returns a fake object and does not persist the new paper item. It can therefore not be queried after the insertion mutation has been executed.
310
310
311
311
#### Client
312
-
Based on [this tutorial](https://www.apollographql.com/docs/react/get-started/) we can now also create a simple React client that calls the query implemented above.
312
+
Based on [this tutorial](https://www.apollographql.com/docs/react/get-started/), we can now also create a simple React client that calls the query implemented above.
313
313
314
314
Just create a project and initialize it with the following commands:
315
315
@@ -400,7 +400,7 @@ function App() {
400
400
render(<App />, document.getElementById("root"));
401
401
```
402
402
403
-
**Note** that we used the URL `localhost:4000` to connect to our Apollo server started above.
403
+
Note that we used the URL `localhost:4000` to connect to our Apollo server started above.
404
404
405
405
When adding the following start scripts to your `package.json` file, you can start the client with `npm start`:
406
406
@@ -429,10 +429,10 @@ An easy way to get an impression of how the code generator works is by using the
429
429
430
430
<atarget="_blank"href="./../media/code-generator-live-demo.png"></a>
431
431
432
-
We created an example Java (Spring Boot) application that uses the code generator. You find the complete example project [here](https://github.com/Microservice-API-Patterns/MDSL-Specification/tree/master/examples/graphql-example/spring-boot-example/).
432
+
There is an example Java (Spring Boot) application that uses the code generator. You find the complete example project [here](https://github.com/Microservice-API-Patterns/MDSL-Specification/tree/master/examples/graphql-example/spring-boot-example/).
433
433
434
434
#### Create Spring Boot (Java) Application
435
-
First, we created a classic Spring Boot project with [Spring initializr](https://start.spring.io/) (Gradle project).
435
+
Start with a classic Spring Boot project with [Spring Initializr](https://start.spring.io/) (Gradle project).
436
436
437
437
In order to use the code generator, add the following Gradle plugin:
438
438
@@ -476,6 +476,8 @@ Then, create a `package.json` file for calling the generator via yarn:
476
476
}
477
477
```
478
478
479
+
Note that the dependencies might been updated when you read this; use a version that suits you. <!-- TODO v55 use latest ones (see https://github.com/Microservice-API-Patterns/MDSL-Specification/security/dependabot) -->
480
+
479
481
In addition, create a `codegen.yml` file to configure the code generator:
480
482
481
483
```yml
@@ -491,7 +493,15 @@ generates:
491
493
492
494
As you can see, we expect the GraphQL schema under `src/main/resources/schema.graphql`. We copied our example schema from the top of this page into the corresponding folder.
493
495
494
-
Now we can call `./gradlew yarn` to call the generator for the first time. From this time on, `./gradlew clean build` will always generate the sources into the `io.mdsl.graphql.javaexampleapp.generated` package.
496
+
Now we can call
497
+
498
+
> `gradlew yarn` <!-- TODO v55 not working, lock file needs to be crated first (manual step) -->
499
+
500
+
to invoke the generator for the first time. From now on,
501
+
502
+
> `gradlew clean build`
503
+
504
+
will always generate the sources into the `io.mdsl.graphql.javaexampleapp.generated` package.
495
505
496
506
Based on the generated types we implemented one of the resolver interfaces. Again, the _lookupPapersFromAuthor_ operation:
497
507
@@ -567,13 +577,24 @@ public class GraphQLProvider {
567
577
}
568
578
```
569
579
570
-
**Note** that we had to provide implementations for our custom scalars (_Void_ and _Raw_). You find it in our [example project](https://github.com/Microservice-API-Patterns/MDSL-Specification/tree/master/examples/graphql-example/spring-boot-example/).
580
+
Note that we had to provide implementations for our custom scalars (_Void_ and _Raw_). You find it in our [example project](https://github.com/Microservice-API-Patterns/MDSL-Specification/tree/master/examples/graphql-example/spring-boot-example/).
571
581
572
-
The Spring Boot application can now be started with `./gradlew clean bootRun` (please adopt the command invocation to your OS). As soon as the application is started, you can run the same query as we did before with Apollo. The following screenshot shows our test with Postman:
582
+
The Spring Boot application can now be started with `gradlew clean bootRun` (please adopt the command invocation to your OS). As soon as the application is started, you can run the same query as we did before with Apollo. The following screenshot shows our test with Postman:
573
583
574
584
<a target="_blank" href="./../media/spring-boot-test-with-postman.png"></a>
575
585
576
-
That's it. This was a short introduction what you can do with the GraphQL schemas generated by the MDSL tool. Try it out with your own MDSL model, or let [Context Mapper](https://contextmapper.org/docs/mdsl/) generate one for your from your Domain-Driven Design [bounded contexts](https://contextmapper.org/docs/bounded-context/)!
This was a short introduction what you can do with the GraphQL schemas generated by the MDSL tool. Try it out with your own MDSL model, or let [Context Mapper](https://contextmapper.org/docs/mdsl/) generate one for your from your Domain-Driven Design [bounded contexts](https://contextmapper.org/docs/bounded-context/)!
Copy file name to clipboardExpand all lines: docs/generators/jolie.md
+4-4Lines changed: 4 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -20,20 +20,20 @@ In Eclipse, you find the generator in the MDSL context menu:
20
20
21
21
<ahref="./../media/eclipse-jolie-generator-context-menu.png"></a>
22
22
23
-
If you work with the CLI, the following command generates the Jolie specification:
23
+
When working with the CLI, the following command generates the Jolie specification:
24
24
25
25
```bash
26
-
./mdsl -i model.mdsl -g jolie
26
+
mdsl -i model.mdsl -g jolie
27
27
```
28
28
29
-
_Hint:_ Both tools generate the Graphql file into the `src-gen` folder which is located in the projects root directory (Eclipse) or the directory from which the `mdsl` command has been called (CLI). Both tools create the directory automatically in case it does not already exist.
29
+
_Hint:_ Both plugin and CLI generate the file into the `src-gen` folder located in the project root directory (Eclipse plugin) or the directory from which the `mdsl` command has been called (CLI). The directory is created automatically in case it does not already exist.
30
30
31
31
## Example
32
32
The following example illustrates what the generator produces for an exemplary MDSL contract.
33
33
34
34
You find the complete sources (incl. generated `*.ol` (Jolie) file) of this example [here](https://github.com/Microservice-API-Patterns/MDSL-Specification/tree/master/examples/jolie-example).
35
35
36
-
We use the following MDSL model which was an outcome of this [blogpost](https://ozimmer.ch/practices/2020/06/10/ICWEKeynoteAndDemo.html) to illustrate our generator outputs:
36
+
We use the following MDSL model, featured in this [blog post](https://ozimmer.ch/practices/2020/06/10/ICWEKeynoteAndDemo.html), to illustrate our generator outputs:
0 commit comments