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
1diff --git a/src/maasserver/api/doc_oapi.py b/src/maasserver/api/doc_oapi.py
2index e252bbc..b7e3a9d 100644
3--- a/src/maasserver/api/doc_oapi.py
4+++ b/src/maasserver/api/doc_oapi.py
5@@ -214,14 +214,16 @@ def _oapi_item_from_docstring(
6 for param in ap_dict["params"]:
7 description = _prettify(param["description_stripped"])
8 name = param["name"].strip("}{")
9+ path_var = name in uri_params
10 required = (
11 param["options"]["required"].lower() == "true"
12 or name != param["name"]
13 )
14- if param["name"][0] == "{":
15+ # params with special charcters in names don't form part of the request body
16+ if name != param["name"]:
17 param_dict = {
18 "name": name,
19- "in": "path" if name in uri_params else "query",
20+ "in": "path" if path_var else "query",
21 "description": description,
22 "schema": {
23 "type": _type_to_string(param["type"]),
24@@ -229,15 +231,11 @@ def _oapi_item_from_docstring(
25 "required": required,
26 }
27 oper_obj.setdefault("parameters", []).append(param_dict)
28- elif http_method.lower() in ("put", "post"):
29- body.setdefault("properties", {}).update(
30- {
31- name: {
32- "description": description,
33- "type": _type_to_string(param["type"]),
34- }
35- }
36- )
37+ else:
38+ body.setdefault("properties", {})[name] = {
39+ "description": description,
40+ "type": _type_to_string(param["type"]),
41+ }
42 if required:
43 body.setdefault("required", []).append(name)
44

Subscribers

People subscribed via source and target branches