oed-cli 0.1.1__tar.gz → 0.1.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {oed_cli-0.1.1/src/oed_cli.egg-info → oed_cli-0.1.2}/PKG-INFO +2 -2
- {oed_cli-0.1.1 → oed_cli-0.1.2}/README.md +1 -1
- {oed_cli-0.1.1 → oed_cli-0.1.2}/pyproject.toml +1 -1
- {oed_cli-0.1.1 → oed_cli-0.1.2}/src/oed_cli/__init__.py +1 -1
- {oed_cli-0.1.1 → oed_cli-0.1.2}/src/oed_cli/invoke.py +9 -2
- {oed_cli-0.1.1 → oed_cli-0.1.2/src/oed_cli.egg-info}/PKG-INFO +2 -2
- {oed_cli-0.1.1 → oed_cli-0.1.2}/tests/test_dynamic.py +43 -0
- {oed_cli-0.1.1 → oed_cli-0.1.2}/LICENSE +0 -0
- {oed_cli-0.1.1 → oed_cli-0.1.2}/setup.cfg +0 -0
- {oed_cli-0.1.1 → oed_cli-0.1.2}/src/oed_cli/__main__.py +0 -0
- {oed_cli-0.1.1 → oed_cli-0.1.2}/src/oed_cli/cli.py +0 -0
- {oed_cli-0.1.1 → oed_cli-0.1.2}/src/oed_cli/discovery.py +0 -0
- {oed_cli-0.1.1 → oed_cli-0.1.2}/src/oed_cli/dynamic.py +0 -0
- {oed_cli-0.1.1 → oed_cli-0.1.2}/src/oed_cli/errors.py +0 -0
- {oed_cli-0.1.1 → oed_cli-0.1.2}/src/oed_cli/http.py +0 -0
- {oed_cli-0.1.1 → oed_cli-0.1.2}/src/oed_cli/main.py +0 -0
- {oed_cli-0.1.1 → oed_cli-0.1.2}/src/oed_cli/py.typed +0 -0
- {oed_cli-0.1.1 → oed_cli-0.1.2}/src/oed_cli.egg-info/SOURCES.txt +0 -0
- {oed_cli-0.1.1 → oed_cli-0.1.2}/src/oed_cli.egg-info/dependency_links.txt +0 -0
- {oed_cli-0.1.1 → oed_cli-0.1.2}/src/oed_cli.egg-info/entry_points.txt +0 -0
- {oed_cli-0.1.1 → oed_cli-0.1.2}/src/oed_cli.egg-info/requires.txt +0 -0
- {oed_cli-0.1.1 → oed_cli-0.1.2}/src/oed_cli.egg-info/top_level.txt +0 -0
- {oed_cli-0.1.1 → oed_cli-0.1.2}/tests/test_cli.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: oed-cli
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.2
|
|
4
4
|
Summary: oed — openEuler Infra command line. Auto-discovered, AI-friendly.
|
|
5
5
|
Author: oed-cli contributors
|
|
6
6
|
License: Apache-2.0
|
|
@@ -97,7 +97,7 @@ pip install -e .
|
|
|
97
97
|
Verify:
|
|
98
98
|
|
|
99
99
|
```bash
|
|
100
|
-
oed --version # → oed, version 0.2
|
|
100
|
+
oed --version # → oed, version 0.1.2
|
|
101
101
|
```
|
|
102
102
|
|
|
103
103
|
---
|
|
@@ -34,6 +34,12 @@ def _fill_path(template: str, params: dict[str, Any]) -> tuple[str, list[str]]:
|
|
|
34
34
|
|
|
35
35
|
Returns the rendered path and the list of placeholder names that were
|
|
36
36
|
not provided, so the caller can raise a precise error.
|
|
37
|
+
|
|
38
|
+
Huawei APIG marks required path params with a trailing ``+`` in the
|
|
39
|
+
template (``/t/{id+}``); the ``+`` is a spec-side marker that never
|
|
40
|
+
appears in the real request URL or in the declared
|
|
41
|
+
``parameters[].name``. Strip it so the lookup matches what the
|
|
42
|
+
caller actually provided under ``--<flag>`` / ``--params``.
|
|
37
43
|
"""
|
|
38
44
|
|
|
39
45
|
missing: list[str] = []
|
|
@@ -48,13 +54,14 @@ def _fill_path(template: str, params: dict[str, Any]) -> tuple[str, list[str]]:
|
|
|
48
54
|
if name_end == -1:
|
|
49
55
|
parts.append(head + sep + chunk)
|
|
50
56
|
break
|
|
51
|
-
|
|
57
|
+
raw_name = chunk[:name_end]
|
|
58
|
+
name = raw_name.rstrip("+")
|
|
52
59
|
parts.append(head)
|
|
53
60
|
if name in params:
|
|
54
61
|
parts.append(str(params[name]))
|
|
55
62
|
else:
|
|
56
63
|
missing.append(name)
|
|
57
|
-
parts.append("{" +
|
|
64
|
+
parts.append("{" + raw_name + "}")
|
|
58
65
|
rest = chunk[name_end + 1 :]
|
|
59
66
|
return "".join(parts), missing
|
|
60
67
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: oed-cli
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.2
|
|
4
4
|
Summary: oed — openEuler Infra command line. Auto-discovered, AI-friendly.
|
|
5
5
|
Author: oed-cli contributors
|
|
6
6
|
License: Apache-2.0
|
|
@@ -97,7 +97,7 @@ pip install -e .
|
|
|
97
97
|
Verify:
|
|
98
98
|
|
|
99
99
|
```bash
|
|
100
|
-
oed --version # → oed, version 0.2
|
|
100
|
+
oed --version # → oed, version 0.1.2
|
|
101
101
|
```
|
|
102
102
|
|
|
103
103
|
---
|
|
@@ -526,6 +526,49 @@ def test_call_operation_missing_path_param_raises_user_error(patched):
|
|
|
526
526
|
call_operation(op) # no id
|
|
527
527
|
|
|
528
528
|
|
|
529
|
+
def test_call_operation_strips_trailing_plus_in_path_template(patched):
|
|
530
|
+
"""Huawei APIG marks required path params with ``{name+}`` in the path
|
|
531
|
+
template (``/t/{id+}``). The declared ``parameters[].name`` is plain
|
|
532
|
+
``id`` — the ``+`` is a spec-side marker. ``oed forum getTopic --id 19308``
|
|
533
|
+
must therefore resolve the user's ``--id`` value into the rendered URL,
|
|
534
|
+
not complain that ``id+`` is missing."""
|
|
535
|
+
|
|
536
|
+
from oed_cli.dynamic import operations_table
|
|
537
|
+
from oed_cli.invoke import call_operation
|
|
538
|
+
|
|
539
|
+
spec = {
|
|
540
|
+
"openapi": "3.0.1",
|
|
541
|
+
"paths": {
|
|
542
|
+
"/t/{id+}": {
|
|
543
|
+
"get": {
|
|
544
|
+
"operationId": "getTopic",
|
|
545
|
+
"parameters": [
|
|
546
|
+
{"in": "path", "name": "id",
|
|
547
|
+
"required": True, "schema": {"type": "string"}},
|
|
548
|
+
],
|
|
549
|
+
}
|
|
550
|
+
}
|
|
551
|
+
},
|
|
552
|
+
}
|
|
553
|
+
table = operations_table(spec, "forum", base_url="https://apig.osinfra.cn")
|
|
554
|
+
op = table["getTopic"]
|
|
555
|
+
|
|
556
|
+
payload = call_operation(op, params={"id": "19308"})
|
|
557
|
+
assert patched["captured"]["url"].endswith("/t/19308")
|
|
558
|
+
assert payload["ok"] is True
|
|
559
|
+
assert payload["status"] == 200
|
|
560
|
+
|
|
561
|
+
# Missing-param error must use the clean name (what the user types),
|
|
562
|
+
# not the APIG-side ``id+`` form.
|
|
563
|
+
from oed_cli.errors import UserError
|
|
564
|
+
try:
|
|
565
|
+
call_operation(op)
|
|
566
|
+
except UserError as exc:
|
|
567
|
+
assert exc.to_dict()["message"] == "missing path params: ['id']"
|
|
568
|
+
else:
|
|
569
|
+
pytest.fail("expected UserError for missing path param")
|
|
570
|
+
|
|
571
|
+
|
|
529
572
|
# ---------- main.py dispatch ----------
|
|
530
573
|
|
|
531
574
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|