Merge ~lloydwaltersj/maas:oapi-include-more-methods into maas:master

Proposed by Jack Lloyd-Walters
Status: Merged
Approved by: Jack Lloyd-Walters
Approved revision: 1195a41839dd8cc0966e0cde9a3c6c888e32cfca
Merge reported by: MAAS Lander
Merged at revision: not available
Proposed branch: ~lloydwaltersj/maas:oapi-include-more-methods
Merge into: maas:master
Diff against target: 43 lines (+9/-11)
1 file modified
src/maasserver/api/doc_oapi.py (+9/-11)
Reviewer Review Type Date Requested Status
MAAS Lander Approve
Adam Collard (community) Approve
Review via email: mp+438116@code.launchpad.net

Commit message

Modify OpenApi method generation to capture all method types

To post a comment you must log in.
Revision history for this message
MAAS Lander (maas-lander) wrote :

UNIT TESTS
-b oapi-include-more-methods lp:~lloydwaltersj/maas/+git/maas into -b master lp:~maas-committers/maas

STATUS: FAILED
LOG: http://maas-ci.internal:8080/job/maas-tester/2030/consoleText
COMMIT: 56b0ff3eab2bdb7143381fd809f66de11fab57de

review: Needs Fixing
Revision history for this message
Adam Collard (adam-collard) wrote (last edit ):
c46bacb... by Jack Lloyd-Walters

fix duplicate parameter names

Revision history for this message
Adam Collard (adam-collard) :
Revision history for this message
MAAS Lander (maas-lander) wrote :

UNIT TESTS
-b oapi-include-more-methods lp:~lloydwaltersj/maas/+git/maas into -b master lp:~maas-committers/maas

STATUS: SUCCESS
COMMIT: c46bacb93fb827e64feb491b6e0721f7fe7e2914

review: Approve
Revision history for this message
Jack Lloyd-Walters (lloydwaltersj) :
cd59eb5... by Jack Lloyd-Walters

Remove curly brace

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

UNIT TESTS
-b oapi-include-more-methods lp:~lloydwaltersj/maas/+git/maas into -b master lp:~maas-committers/maas

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

review: Needs Fixing
081a49a... by Jack Lloyd-Walters

remove uri_variables from request body

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

UNIT TESTS
-b oapi-include-more-methods lp:~lloydwaltersj/maas/+git/maas into -b master lp:~maas-committers/maas

STATUS: SUCCESS
COMMIT: 081a49adc3893bd5cdb7b12bff4bf5878b769678

review: Approve
Revision history for this message
Adam Collard (adam-collard) :
1713712... by Jack Lloyd-Walters

use path_var in "in" section of schema

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

UNIT TESTS
-b oapi-include-more-methods lp:~lloydwaltersj/maas/+git/maas into -b master lp:~maas-committers/maas

STATUS: SUCCESS
COMMIT: 1713712413ea2b60f985b7cdd97ee2020aa4645b

review: Approve
Revision history for this message
Adam Collard (adam-collard) wrote :
review: Approve
Revision history for this message
Adam Collard (adam-collard) :
review: Needs Fixing
1195a41... by Jack Lloyd-Walters

modify parameters generation

Revision history for this message
Adam Collard (adam-collard) :
review: Approve
Revision history for this message
MAAS Lander (maas-lander) wrote :

UNIT TESTS
-b oapi-include-more-methods lp:~lloydwaltersj/maas/+git/maas into -b master lp:~maas-committers/maas

STATUS: SUCCESS
COMMIT: 1195a41839dd8cc0966e0cde9a3c6c888e32cfca

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 e252bbc..b7e3a9d 100644
--- a/src/maasserver/api/doc_oapi.py
+++ b/src/maasserver/api/doc_oapi.py
@@ -214,14 +214,16 @@ def _oapi_item_from_docstring(
214 for param in ap_dict["params"]:214 for param in ap_dict["params"]:
215 description = _prettify(param["description_stripped"])215 description = _prettify(param["description_stripped"])
216 name = param["name"].strip("}{")216 name = param["name"].strip("}{")
217 path_var = name in uri_params
217 required = (218 required = (
218 param["options"]["required"].lower() == "true"219 param["options"]["required"].lower() == "true"
219 or name != param["name"]220 or name != param["name"]
220 )221 )
221 if param["name"][0] == "{":222 # params with special charcters in names don't form part of the request body
223 if name != param["name"]:
222 param_dict = {224 param_dict = {
223 "name": name,225 "name": name,
224 "in": "path" if name in uri_params else "query",226 "in": "path" if path_var else "query",
225 "description": description,227 "description": description,
226 "schema": {228 "schema": {
227 "type": _type_to_string(param["type"]),229 "type": _type_to_string(param["type"]),
@@ -229,15 +231,11 @@ def _oapi_item_from_docstring(
229 "required": required,231 "required": required,
230 }232 }
231 oper_obj.setdefault("parameters", []).append(param_dict)233 oper_obj.setdefault("parameters", []).append(param_dict)
232 elif http_method.lower() in ("put", "post"):234 else:
233 body.setdefault("properties", {}).update(235 body.setdefault("properties", {})[name] = {
234 {236 "description": description,
235 name: {237 "type": _type_to_string(param["type"]),
236 "description": description,238 }
237 "type": _type_to_string(param["type"]),
238 }
239 }
240 )
241 if required:239 if required:
242 body.setdefault("required", []).append(name)240 body.setdefault("required", []).append(name)
243241

Subscribers

People subscribed via source and target branches