Merge ~lloydwaltersj/maas:fix-json-response into maas:master

Proposed by Jack Lloyd-Walters
Status: Merged
Approved by: Jack Lloyd-Walters
Approved revision: 41bade65709cdc59b50bb2977437c3ee0a7ed93d
Merge reported by: MAAS Lander
Merged at revision: not available
Proposed branch: ~lloydwaltersj/maas:fix-json-response
Merge into: maas:master
Diff against target: 135 lines (+20/-11)
5 files modified
src/maasserver/api/doc_oapi.py (+9/-0)
src/maasserver/api/nodes.py (+1/-1)
src/maasserver/api/rackcontrollers.py (+2/-2)
src/maasserver/api/resourcepools.py (+4/-4)
src/maasserver/api/zones.py (+4/-4)
Reviewer Review Type Date Requested Status
Alexsander de Souza Approve
MAAS Lander Approve
Review via email: mp+428480@code.launchpad.net

Commit message

Update api JSON responses declared as plain text

Description of the change

we had a few JSON payloads decalred as plaintext when they shouldn't have been

To post a comment you must log in.
Revision history for this message
Alexsander de Souza (alexsander-souza) wrote :

need to add the BSON mime type to _oapi_item_from_docstring()

review: Needs Fixing
b7eafdd... by Jack Lloyd-Walters

add BSON to oapi_item_from_docstring

Revision history for this message
MAAS Lander (maas-lander) wrote :

UNIT TESTS
-b fix-json-response lp:~lloydwaltersj/maas/+git/maas into -b master lp:~maas-committers/maas

STATUS: FAILED
LOG: http://maas-ci.internal:8080/job/maas-tester/341/consoleText
COMMIT: 6136074c7480049342c1e8483256ea17e3e1ab61

review: Needs Fixing
Revision history for this message
MAAS Lander (maas-lander) wrote :

UNIT TESTS
-b fix-json-response lp:~lloydwaltersj/maas/+git/maas into -b master lp:~maas-committers/maas

STATUS: FAILED
LOG: http://maas-ci.internal:8080/job/maas-tester/342/consoleText
COMMIT: b7eafddb0e891c31ef9409558c79949552e05dcf

review: Needs Fixing
41bade6... by Jack Lloyd-Walters

stop BSON error with rest api

Revision history for this message
MAAS Lander (maas-lander) wrote :

UNIT TESTS
-b fix-json-response lp:~lloydwaltersj/maas/+git/maas into -b master lp:~maas-committers/maas

STATUS: FAILED
LOG: http://maas-ci.internal:8080/job/maas-tester/345/consoleText
COMMIT: 41bade65709cdc59b50bb2977437c3ee0a7ed93d

review: Needs Fixing
Revision history for this message
Jack Lloyd-Walters (lloydwaltersj) wrote :

jenkins: !test

Revision history for this message
MAAS Lander (maas-lander) wrote :

UNIT TESTS
-b fix-json-response lp:~lloydwaltersj/maas/+git/maas into -b master lp:~maas-committers/maas

STATUS: SUCCESS
COMMIT: 41bade65709cdc59b50bb2977437c3ee0a7ed93d

review: Approve
Revision history for this message
Alexsander de Souza (alexsander-souza) wrote :

+1

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
diff --git a/src/maasserver/api/doc_oapi.py b/src/maasserver/api/doc_oapi.py
index d747499..8d49f52 100644
--- a/src/maasserver/api/doc_oapi.py
+++ b/src/maasserver/api/doc_oapi.py
@@ -268,6 +268,15 @@ def _oapi_item_from_docstring(function, http_method, uri_params):
268 },268 },
269 },269 },
270 }270 }
271 case "bson":
272 response["content"] = {
273 "application/bson": {
274 "schema": {
275 "type": "object",
276 "additionalProperties": True,
277 },
278 },
279 }
271280
272 status_code = status["name"]281 status_code = status["name"]
273 if not status_code.isdigit():282 if not status_code.isdigit():
diff --git a/src/maasserver/api/nodes.py b/src/maasserver/api/nodes.py
index f7152c0..3ff069c 100644
--- a/src/maasserver/api/nodes.py
+++ b/src/maasserver/api/nodes.py
@@ -535,7 +535,7 @@ class NodeHandler(OperationsHandler):
535535
536 @success (http-status-code) "200" 200536 @success (http-status-code) "200" 200
537537
538 @success (content) "success-content" A BSON object represented here in538 @success (json) "success-content" A BSON object represented here in
539 ASCII using ``bsondump example.bson``.539 ASCII using ``bsondump example.bson``.
540 @success-example "success-content" [exkey=details] placeholder text540 @success-example "success-content" [exkey=details] placeholder text
541541
diff --git a/src/maasserver/api/rackcontrollers.py b/src/maasserver/api/rackcontrollers.py
index 71710fb..2dce645 100644
--- a/src/maasserver/api/rackcontrollers.py
+++ b/src/maasserver/api/rackcontrollers.py
@@ -157,7 +157,7 @@ class RackControllerHandler(NodeHandler, PowerMixin):
157 controller. If not given the default domain is used.157 controller. If not given the default domain is used.
158158
159 @success (http-status-code) "200" 200159 @success (http-status-code) "200" 200
160 @success (content) "success-json" A JSON object containing the updated160 @success (json) "success-json" A JSON object containing the updated
161 rack-controller object.161 rack-controller object.
162 @success-example "success-json" [exkey=update] placeholder162 @success-example "success-json" [exkey=update] placeholder
163163
@@ -280,7 +280,7 @@ class RackControllersHandler(NodesHandler, PowersMixin):
280 @description Queries all rack controllers for power information.280 @description Queries all rack controllers for power information.
281281
282 @success (http-status-code) "200" 200282 @success (http-status-code) "200" 200
283 @success (content) "success-json" A JSON object containing a dictionary283 @success (json) "success-json" A JSON object containing a dictionary
284 with system_ids as keys and power parameters as values.284 with system_ids as keys and power parameters as values.
285 @success-example "success-json" [exkey=power-params-multi] placeholder285 @success-example "success-json" [exkey=power-params-multi] placeholder
286 """286 """
diff --git a/src/maasserver/api/resourcepools.py b/src/maasserver/api/resourcepools.py
index a28c6fd..2b37f3f 100644
--- a/src/maasserver/api/resourcepools.py
+++ b/src/maasserver/api/resourcepools.py
@@ -45,7 +45,7 @@ class ResourcePoolHandler(ModelOperationsHandler):
45 @param-example "{id}" mypool45 @param-example "{id}" mypool
4646
47 @success (http-status-code) "server_success" 20047 @success (http-status-code) "server_success" 200
48 @success (content) "content_success" A JSON object containing48 @success (json) "content_success" A JSON object containing
49 resource pool information49 resource pool information
50 @success-example "content_success"50 @success-example "content_success"
51 {51 {
@@ -80,7 +80,7 @@ class ResourcePoolHandler(ModelOperationsHandler):
80 description.80 description.
8181
82 @success (http-status-code) "serversuccess" 20082 @success (http-status-code) "serversuccess" 200
83 @success (content) "contentsuccess" A JSON object containing details83 @success (json) "contentsuccess" A JSON object containing details
84 about your new resource pool.84 about your new resource pool.
85 @success-example "contentsuccess"85 @success-example "contentsuccess"
86 {86 {
@@ -147,7 +147,7 @@ class ResourcePoolsHandler(ModelCollectionOperationsHandler):
147 of my new resource pool.147 of my new resource pool.
148148
149 @success (http-status-code) "serversuccess" 200149 @success (http-status-code) "serversuccess" 200
150 @success (content) "contentsuccess" A JSON object containing details150 @success (json) "contentsuccess" A JSON object containing details
151 about your new resource pool.151 about your new resource pool.
152 @success-example "contentsuccess"152 @success-example "contentsuccess"
153 {153 {
@@ -170,7 +170,7 @@ class ResourcePoolsHandler(ModelCollectionOperationsHandler):
170 Note that there is always at least one resource pool: default.170 Note that there is always at least one resource pool: default.
171171
172 @success (http-status-code) "serversuccess" 200172 @success (http-status-code) "serversuccess" 200
173 @success (content) "contentsuccess" A JSON object containing a173 @success (json) "contentsuccess" A JSON object containing a
174 list of resource pools.174 list of resource pools.
175 @success-example "contentsuccess"175 @success-example "contentsuccess"
176 [176 [
diff --git a/src/maasserver/api/zones.py b/src/maasserver/api/zones.py
index 698caab..a3fafae 100644
--- a/src/maasserver/api/zones.py
+++ b/src/maasserver/api/zones.py
@@ -50,7 +50,7 @@ class ZoneHandler(ModelOperationsHandler):
50 @param-example "{name}" myzone50 @param-example "{name}" myzone
5151
52 @success (http-status-code) "server_success" 20052 @success (http-status-code) "server_success" 200
53 @success (content) "content_success" A JSON object containing zone53 @success (json) "content_success" A JSON object containing zone
54 information54 information
55 @success-example "content_success"55 @success-example "content_success"
56 {56 {
@@ -82,7 +82,7 @@ class ZoneHandler(ModelOperationsHandler):
82 @param-example "description" An updated zone description.82 @param-example "description" An updated zone description.
8383
84 @success (http-status-code) "serversuccess" 20084 @success (http-status-code) "serversuccess" 200
85 @success (content) "contentsuccess" A JSON object containing details85 @success (json) "contentsuccess" A JSON object containing details
86 about your new zone.86 about your new zone.
87 @success-example "contentsuccess"87 @success-example "contentsuccess"
88 {88 {
@@ -138,7 +138,7 @@ class ZonesHandler(ModelCollectionOperationsHandler):
138 new zone.138 new zone.
139139
140 @success (http-status-code) "serversuccess" 204140 @success (http-status-code) "serversuccess" 204
141 @success (content) "contentsuccess" A JSON object containing details141 @success (json) "contentsuccess" A JSON object containing details
142 about your new zone.142 about your new zone.
143 @success-example "contentsuccess"143 @success-example "contentsuccess"
144 {144 {
@@ -160,7 +160,7 @@ class ZonesHandler(ModelCollectionOperationsHandler):
160 at least one zone: default.160 at least one zone: default.
161161
162 @success (http-status-code) "serversuccess" 200162 @success (http-status-code) "serversuccess" 200
163 @success (content) "contentsuccess" A JSON object containing a list163 @success (json) "contentsuccess" A JSON object containing a list
164 of zones.164 of zones.
165 @success-example "contentsuccess"165 @success-example "contentsuccess"
166 [166 [

Subscribers

People subscribed via source and target branches