The wiki should document the whole API surface: the machine endpoints and the plugin API #170
Labels
No labels
accessibility
authentication
breaking change
bug
documentation
enhancement
interface
internationalisation
observability
security
tier
1
tier
2
tier
3
tier/4
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Postulo/postulo#170
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Decision
The wiki documents the whole of Postulo's API surface, core and plugin, and is the only place that does (#169).
Where it stands
I measured it against the code rather than by reading.
The REST API (
/api/v1, from the API's own OpenAPI schema). The API names all 39 operations, three of them in shorthand, and points at/api/v1/openapi.jsonfor the rest. Two details are missing:reasontakes when a listing is discarded (not_for_me,pay,location,closed,other);GET /meanswers (name,owner,scopes,expires_at,last_used_at).Corrected after filing: the first version of this issue said three operations were never mentioned.
/meis there as a full URL in Using it, and discard and restore are in the Writing table as/shortlist · /discard (reason) · /restore. My first check matched paths too literally.The endpoints for machines outside
/api/v1:/healthz,/logsand/metrics. They appear only as rows in Configuration and notes in Troubleshooting. Nothing says what each returns, how it is guarded, or what a collector should expect.The plugin surface (
postulo.plugins.api, the promise from #126). None of it is in the wiki. It lives in the core repository'sdocs/PLUGINS.md, 1,152 lines. That guide never names 8 of the 37 promised names: the interfaces a plugin of each kind implements (ConnectedPlugin,FeaturePlugin,ImporterPlugin,OutboxPlugin,SourcePlugin,StorePlugin,SyncPlugin,TransportPlugin). It describes each kind in prose without saying what to writeclass Mine(...)against.What doing it is
/meanswers./healthz,/logsand/metricsanswer, with which token, at what rate, and how each is switched on.postulo.plugins.apiand every kind of plugin with the interface it implements and its entry-point group.docs/PLUGINS.mdbecomes a pointer, because six plugin repositories and the metadata of every published plugin link to it. The plugin API's own error message, "not part of the plugin surface. See …", points at the wiki page.Worth being careful about
pyproject.tomllinks are in six repositories, and published wheels cannot be changed at all.The wiki should document the whole API surface: three REST operations, the machine endpoints, and the plugin APIto The wiki should document the whole API surface: the machine endpoints and the plugin APIDone, in both repositories:
postulo.wiki@d95b27dandpostulo@d1c8f8b0.The wiki now has the whole surface
/meanswers, plus one list of all 39 calls with method, path and scope, generated from the API's own routers. That is how I found each scope: the OpenAPI schema does not carry it./healthz,/metricsand/logs. What each returns, how it is switched on and guarded, the401/429/503answers, the parameters of/logs, and every metric with its labels, plus a Prometheus scrape configuration.docs/PLUGINS.md): it opens with every kind of plugin, its entry-point group and the interface it satisfies, and carries a reference of all 37 namespostulo.plugins.apipromises, the eight interfaces the guide never named among them.docs/PLUGINS.mdlink here. All four pages render publicly.In the core
docs/PLUGINS.mdis a pointer to the wiki page. Six plugins'pyproject.tomlfiles, and every published plugin's metadata, link to it.TRANSLATING.mdand the comments follow.tests/test_wiki_surface.pyholds the three pages to the code, both ways. A call, metric, promised name or entry-point group without its line fails, and so does a line for a call that no longer exists. It reads../postulo.wikiand skips where the wiki is not checked out, as in CI. I showed it failing by removing one line from each page, then restored them.Found while writing it, and not fixed here
Two names plugins use are not on the surface. A notifier's
send()is handedpostulo.notifications.base.Notification, and the guide's own example imports it from there. The client'sDestinationRefusedis what paperless catches (postulo-paperless#1). Writing a plugin says so plainly rather than pretending otherwise. Adding them topostulo.plugins.apiis a surface change worth its own issue.Correction, made on the issue body too: I first said three REST operations were undocumented. They were all there,
/meas a full URL and discard and restore in shorthand; my matcher was too literal.