Skip to content

Commit e5c4057

Browse files
committed
Ensure every api returns something
1 parent c34ad0f commit e5c4057

23 files changed

+557
-57
lines changed

design/pkgs.go

+14
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ var _ = Service("indexes", func() {
2020

2121
Method("add", func() {
2222
Payload(IndexPayload)
23+
Result(Operation)
2324
HTTP(func() {
2425
POST("/pkgs/indexes/add")
2526
Response(StatusOK)
@@ -28,6 +29,7 @@ var _ = Service("indexes", func() {
2829

2930
Method("remove", func() {
3031
Payload(IndexPayload)
32+
Result(Operation)
3133
HTTP(func() {
3234
POST("/pkgs/indexes/delete")
3335
Response(StatusOK)
@@ -60,6 +62,7 @@ var _ = Service("tools", func() {
6062
Response("not_found", StatusBadRequest)
6163
})
6264
Payload(ToolPayload)
65+
Result(Operation)
6366
HTTP(func() {
6467
PUT("/pkgs/tools/installed")
6568
Response(StatusOK)
@@ -68,6 +71,7 @@ var _ = Service("tools", func() {
6871

6972
Method("remove", func() {
7073
Payload(ToolPayload)
74+
Result(Operation)
7175

7276
HTTP(func() {
7377
DELETE("/pkgs/tools/installed/{packager}/{name}/{version}")
@@ -120,3 +124,13 @@ var Tool = ResultType("application/vnd.arduino.tool", func() {
120124

121125
Required("name", "version", "packager")
122126
})
127+
128+
var Operation = ResultType("application/vnd.arduino.operation", func() {
129+
Description("Describes the result of an operation.")
130+
TypeName("Operation")
131+
132+
Attribute("status", String, "The status of the operation", func() {
133+
Example("ok")
134+
})
135+
Required("status")
136+
})

gen/http/indexes/client/encode_decode.go

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

gen/http/indexes/client/types.go

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

gen/http/indexes/server/encode_decode.go

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

gen/http/indexes/server/types.go

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

gen/http/openapi.json

+1-1
Large diffs are not rendered by default.

gen/http/openapi.yaml

+60
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ paths:
6363
responses:
6464
"200":
6565
description: OK response.
66+
schema:
67+
$ref: '#/definitions/IndexesAddResponseBody'
6668
"400":
6769
description: Bad Request response.
6870
schema:
@@ -86,6 +88,8 @@ paths:
8688
responses:
8789
"200":
8890
description: OK response.
91+
schema:
92+
$ref: '#/definitions/IndexesRemoveResponseBody'
8993
"400":
9094
description: Bad Request response.
9195
schema:
@@ -136,6 +140,8 @@ paths:
136140
responses:
137141
"200":
138142
description: OK response.
143+
schema:
144+
$ref: '#/definitions/ToolsInstallResponseBody'
139145
schemes:
140146
- http
141147
/v2/pkgs/tools/installed/{packager}/{name}/{version}:
@@ -168,6 +174,8 @@ paths:
168174
responses:
169175
"200":
170176
description: OK response.
177+
schema:
178+
$ref: '#/definitions/ToolsRemoveResponseBody'
171179
schemes:
172180
- http
173181
definitions:
@@ -183,6 +191,19 @@ definitions:
183191
url: http://downloads.arduino.cc/packages/package_index.json
184192
required:
185193
- url
194+
IndexesAddResponseBody:
195+
title: 'Mediatype identifier: application/vnd.arduino.operation; view=default'
196+
type: object
197+
properties:
198+
status:
199+
type: string
200+
description: The status of the operation
201+
example: ok
202+
description: AddResponseBody result type (default view)
203+
example:
204+
status: ok
205+
required:
206+
- status
186207
IndexesRemoveRequestBody:
187208
title: IndexesRemoveRequestBody
188209
type: object
@@ -195,6 +216,19 @@ definitions:
195216
url: http://downloads.arduino.cc/packages/package_index.json
196217
required:
197218
- url
219+
IndexesRemoveResponseBody:
220+
title: 'Mediatype identifier: application/vnd.arduino.operation; view=default'
221+
type: object
222+
properties:
223+
status:
224+
type: string
225+
description: The status of the operation
226+
example: ok
227+
description: RemoveResponseBody result type (default view)
228+
example:
229+
status: ok
230+
required:
231+
- status
198232
Indexesadd_invalid_url_response_body:
199233
title: 'Mediatype identifier: application/vnd.goa.error; view=default'
200234
type: object
@@ -392,6 +426,19 @@ definitions:
392426
- name
393427
- version
394428
- packager
429+
ToolsInstallResponseBody:
430+
title: 'Mediatype identifier: application/vnd.arduino.operation; view=default'
431+
type: object
432+
properties:
433+
status:
434+
type: string
435+
description: The status of the operation
436+
example: ok
437+
description: InstallResponseBody result type (default view)
438+
example:
439+
status: ok
440+
required:
441+
- status
395442
ToolsRemoveRequestBody:
396443
title: ToolsRemoveRequestBody
397444
type: object
@@ -409,6 +456,19 @@ definitions:
409456
example:
410457
checksum: Qui modi dolorem.
411458
url: In voluptatibus.
459+
ToolsRemoveResponseBody:
460+
title: 'Mediatype identifier: application/vnd.arduino.operation; view=default'
461+
type: object
462+
properties:
463+
status:
464+
type: string
465+
description: The status of the operation
466+
example: ok
467+
description: RemoveResponseBody result type (default view)
468+
example:
469+
status: ok
470+
required:
471+
- status
412472
ToolsToolResponseCollection:
413473
title: 'Mediatype identifier: application/vnd.arduino.tool; type=collection; view=default'
414474
type: array

0 commit comments

Comments
 (0)