Skip to content

Commit e307f87

Browse files
committed
Use goa v2 to create to manage a /v2 subpath for new rest api
1 parent 2e64e21 commit e307f87

File tree

264 files changed

+80431
-2
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

264 files changed

+80431
-2
lines changed

Gopkg.lock

+89
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Gopkg.toml

+1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
# go-tests = true
2525
# unused-packages = true
2626

27+
required = ["goa.design/goa/codegen/generator"]
2728

2829
[[constraint]]
2930
name = "github.com/Sirupsen/logrus"

design/design.go

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package design
2+
3+
import . "goa.design/goa/dsl"
4+
5+
var _ = API("arduino-create-agent", func() {
6+
Title("Arduino Create Agent")
7+
Description(`A companion of Arduino Create.
8+
Allows the website to perform operations on the user computer,
9+
such as detecting which boards are connected and upload sketches on them.`)
10+
HTTP(func() {
11+
Path("/v2")
12+
})
13+
})

design/tools.go

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
package design
2+
3+
import . "goa.design/goa/dsl"
4+
5+
var _ = Service("tools", func() {
6+
Description("The tools service managed the tools installed in the system.")
7+
Method("list", func() {
8+
Result(Tool)
9+
HTTP(func() {
10+
GET("/tools")
11+
Response(StatusOK)
12+
})
13+
})
14+
})
15+
16+
var Tool = ResultType("application/vnd.arduino.tool", func() {
17+
Description("A tool is an executable program that can upload sketches.")
18+
TypeName("Tool")
19+
20+
Attributes(func() {
21+
Attribute("name", String, "The name of the tool", func() {
22+
Example("avrdude")
23+
})
24+
Attribute("version", String, "The version of the tool", func() {
25+
Example("6.3.0-arduino9")
26+
})
27+
Attribute("packager", String, "The packager of the tool", func() {
28+
Example("arduino")
29+
})
30+
})
31+
32+
Required("name", "version", "packager")
33+
})

gen/http/cli/arduino_create_agent/cli.go

+149
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

gen/http/openapi.json

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"swagger":"2.0","info":{"title":"Arduino Create Agent","description":"A companion of Arduino Create. \n\tAllows the website to perform operations on the user computer, \n\tsuch as detecting which boards are connected and upload sketches on them.","version":""},"host":"localhost:80","basePath":"/v2","consumes":["application/json","application/xml","application/gob"],"produces":["application/json","application/xml","application/gob"],"paths":{"/tools":{"get":{"tags":["tools"],"summary":"list tools","operationId":"tools#list","responses":{"200":{"description":"OK response.","schema":{"$ref":"#/definitions/ToolsListResponseBody"}}},"schemes":["http"]}}},"definitions":{"ToolsListResponseBody":{"title":"Mediatype identifier: application/vnd.arduino.tool; view=default","type":"object","properties":{"name":{"type":"string","description":"The name of the tool","example":"avrdude"},"packager":{"type":"string","description":"The packager of the tool","example":"arduino"},"version":{"type":"string","description":"The version of the tool","example":"6.3.0-arduino9"}},"description":"ListResponseBody result type (default view)","example":{"name":"avrdude","packager":"arduino","version":"6.3.0-arduino9"},"required":["name","version","packager"]}}}

0 commit comments

Comments
 (0)