Merge ~lloydwaltersj/maas:update-required into maas:master

Proposed by Jack Lloyd-Walters
Status: Merged
Approved by: Jack Lloyd-Walters
Approved revision: 98daadf2eafb3cc05ee3baac31f172f93d4b17f2
Merge reported by: MAAS Lander
Merged at revision: not available
Proposed branch: ~lloydwaltersj/maas:update-required
Merge into: maas:master
Diff against target: 57 lines (+7/-5)
4 files modified
src/maasserver/api/doc_oapi.py (+4/-1)
src/maasserver/api/license_keys.py (+2/-2)
src/maasserver/api/pods.py (+1/-1)
src/maasserver/management/commands/generate_oapi_spec.py (+0/-1)
Reviewer Review Type Date Requested Status
Alberto Donato (community) Approve
MAAS Lander Approve
Review via email: mp+428974@code.launchpad.net

Commit message

ensure parameters in path are required

Description of the change

A parameter found in the operation path ie: "id" in "/vm-clusters/{id}" should be marked as required.

To post a comment you must log in.
~lloydwaltersj/maas:update-required updated
1c3c727... by Jack Lloyd-Walters

remove unrelated changes

3d44377... by Jack Lloyd-Walters

add explicit checking for requirement field

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

UNIT TESTS
-b update-required lp:~lloydwaltersj/maas/+git/maas into -b master lp:~maas-committers/maas

STATUS: SUCCESS
COMMIT: 1c3c727eb4ae058ca8c567eb94449f6787f32106

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

UNIT TESTS
-b update-required lp:~lloydwaltersj/maas/+git/maas into -b master lp:~maas-committers/maas

STATUS: SUCCESS
COMMIT: 3d44377d461160f2a1b0a459b91731f5b8893ec4

review: Approve
~lloydwaltersj/maas:update-required updated
98daadf... by Jack Lloyd-Walters

revert yaml.dump change

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

UNIT TESTS
-b update-required lp:~lloydwaltersj/maas/+git/maas into -b master lp:~maas-committers/maas

STATUS: SUCCESS
COMMIT: 98daadf2eafb3cc05ee3baac31f172f93d4b17f2

review: Approve
Revision history for this message
Alberto Donato (ack) wrote :

lgtm

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 c579acd..25922cd 100644
3--- a/src/maasserver/api/doc_oapi.py
4+++ b/src/maasserver/api/doc_oapi.py
5@@ -205,7 +205,10 @@ def _oapi_item_from_docstring(function, http_method, uri_params):
6 for param in ap_dict["params"]:
7 description = _prettify(param["description_stripped"])
8 name = param["name"].strip("}{")
9- required = param["options"]["required"].lower() == "true"
10+ required = (
11+ param["options"]["required"].lower() == "true"
12+ or name != param["name"]
13+ )
14 if param["name"][0] == "{":
15 param_dict = {
16 "name": name,
17diff --git a/src/maasserver/api/license_keys.py b/src/maasserver/api/license_keys.py
18index ce95254..0daec6c 100644
19--- a/src/maasserver/api/license_keys.py
20+++ b/src/maasserver/api/license_keys.py
21@@ -165,10 +165,10 @@ class LicenseKeyHandler(OperationsHandler):
22 @description Delete license key for the given operation system and
23 distro series.
24
25- @param (string) "{osystem}" [required=false] Operating system that the
26+ @param (string) "{osystem}" [required=true] Operating system that the
27 key belongs to.
28
29- @param (string) "{distro_series}" [required=false] OS release that the
30+ @param (string) "{distro_series}" [required=true] OS release that the
31 key belongs to.
32
33 @success (http-status-code) "server-success" 204
34diff --git a/src/maasserver/api/pods.py b/src/maasserver/api/pods.py
35index f4bfbea..8af6775 100644
36--- a/src/maasserver/api/pods.py
37+++ b/src/maasserver/api/pods.py
38@@ -200,7 +200,7 @@ class VmHostHandler(OperationsHandler):
39 @description Performs VM host discovery and updates all discovered
40 information and discovered machines.
41
42- @param (int) "{id}" [required=false] The VM host's ID.
43+ @param (int) "{id}" [required=true] The VM host's ID.
44
45 @success (json) "success-json" A VM host JSON object.
46 @success-example "success-json" [exkey=refresh-vmhost] placeholder text
47diff --git a/src/maasserver/management/commands/generate_oapi_spec.py b/src/maasserver/management/commands/generate_oapi_spec.py
48index 5299fcc..096d779 100644
49--- a/src/maasserver/management/commands/generate_oapi_spec.py
50+++ b/src/maasserver/management/commands/generate_oapi_spec.py
51@@ -3,7 +3,6 @@
52
53 """Django command: generate the Open API specification."""
54
55-
56 from django.core.management.base import BaseCommand
57 import yaml
58

Subscribers

People subscribed via source and target branches