-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add new `Endpoint` and `Calls` DSL These make it possible to provide information on endpoints used on containers (services). The generated expressions contain the information which also gets written to the serialized JSON. Note that the endpoint information is not currently used by the diagramming tool. * Code review fixes
- Loading branch information
Showing
10 changed files
with
218 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# JSON Model Example | ||
|
||
This example `model` package contains a valid DSL definition of a simple | ||
software system that makes use of the `Endpoint` and `Calls` DSLs. The | ||
main function in the `main` package serializes the underlying model as | ||
JSON and prints it to standard output. | ||
|
||
## Usage | ||
|
||
To run this example, execute the following from the examples/json | ||
directory: | ||
|
||
``` | ||
go run main.go | ||
``` | ||
|
||
This will print the model as JSON to standard output. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
|
||
"goa.design/model/codegen" | ||
) | ||
|
||
// Executes the DSL and serializes the resulting model to JSON. | ||
func main() { | ||
// Run the model DSL | ||
js, err := codegen.JSON("goa.design/model/examples/json/model", true) | ||
if err != nil { | ||
panic(err) | ||
} | ||
// Print the JSON | ||
fmt.Println(string(js)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package design | ||
|
||
import . "goa.design/model/dsl" | ||
|
||
var _ = Design("Getting Started", "This is a model of my software system.", func() { | ||
var System = SoftwareSystem("Software System", "My software system.", func() { | ||
Container("Application Database", "Stores application data.", func() { | ||
Tag("database") | ||
}) | ||
Container("Web Application", "Delivers content to users.", func() { | ||
Endpoint("Web", "Delivers HTML pages.") | ||
Uses("Application Database", "Reads from and writes to", "MySQL", Synchronous) | ||
}) | ||
Container("Load Balancer", "Distributes requests across the Web Application instances.", func() { | ||
Uses("Web Application", "Routes requests to", "HTTPS", Synchronous, func() { | ||
Calls("Web") | ||
}) | ||
}) | ||
Tag("system") | ||
}) | ||
|
||
Person("User", "A user of my software system.", func() { | ||
Uses(System, "Uses", Synchronous) | ||
Tag("person") | ||
}) | ||
|
||
Views(func() { | ||
SystemContextView(System, "SystemContext", "An example of a System Context diagram.", func() { | ||
AddAll() | ||
AutoLayout(RankLeftRight) | ||
}) | ||
Styles(func() { | ||
ElementStyle("system", func() { | ||
Background("#1168bd") | ||
Color("#ffffff") | ||
}) | ||
ElementStyle("person", func() { | ||
Background("#08427b") | ||
Color("#ffffff") | ||
Shape(ShapePerson) | ||
}) | ||
ElementStyle("database", func() { | ||
Shape(ShapeCylinder) | ||
}) | ||
}) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters