You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
api: Document the item query parameter in the OpenAPI specs
The fallback added in this branch is a public API surface - `pi-hole/web#3818` uses `PUT /api/groups?item=...` as its regular edit path - but nothing described it.
1. `common.yaml` gains a shared `item` query parameter explaining why it exists (browsers collapse a `.`/`..` path segment) and that it is only consulted when the URI path carries no item.
2. `groups`, `clients`, `lists` and `domains` reference it on the operations that take an item, so it shows up on `GET`, `PUT` and `DELETE` alike.
3. Each of the four specs gains an `item_mismatch` example for the `400` returned when the path and the query name different items.
We deliberately do not add `put`/`delete` to the item-less path objects (e.g., `/groups`): FTL reports its endpoints from a static table that lists those methods under `/groups/{name}`, and `test_all_endpoints_cross_check` compares the specs against that table in both directions.
Signed-off-by: DL6ER <dl6er@dl6er.de>
Copy file name to clipboardExpand all lines: src/api/docs/content/specs/common.yaml
+13Lines changed: 13 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -104,3 +104,16 @@ components:
104
104
type: boolean
105
105
required: false
106
106
example: false
107
+
item:
108
+
in: query
109
+
name: item
110
+
description: |
111
+
The item to operate on, as an alternative to naming it in the URI path.
112
+
113
+
Browsers remove a path segment that is `.` or `..` - as well as their percent-encoded forms `%2e` and `%2e%2e` - while they resolve a URL, so an item with such a name can never reach Pi-hole as part of the path. A query parameter is not subject to this normalization, e.g., `PUT /api/groups?item=.`
114
+
115
+
The value is used whenever the URI path carries no item. Both may be given at the same time as long as they are identical: the path is what identifies the resource, so a disagreement is rejected with `400` instead of being silently resolved in favor of either one.
0 commit comments