docs: Avocado Connect API reference; remove legacy web API remnants - #479
Conversation
jasontwong
left a comment
There was a problem hiding this comment.
Automated review found a confirmed data-loss bug in the doc generator plus a CI gap. Details inline.
Remove the deprecated console.peridio.com API tooling (OpenAPI specs, redocly config/lint, unused redoc dependencies) and add a generated Avocado Connect API section under Developer Reference, built from the committed OpenAPI spec via `npm run build-connect-api`. Each endpoint page includes parameter/request/response tables plus a sample curl request and synthesized JSON response body, and every page opts into the Copy for LLM button.
Fixes the CodeQL js/incomplete-sanitization alert — matches the escaping order used in CopyMarkdownButton. Generated output unchanged.
…guard - Merge allOf composition when rendering field tables and sample bodies; Runtime, ProjectWithAccess, CohortWithAccess, GroupWithMembers, and ClaimTokenWithUses were silently dropping all base-schema fields - Escape the response body summary like other table cells - Render all pages before deleting stale ones so a generation failure can't leave the docs dir partially written - Fail on duplicate tag-derived filenames instead of silently overwriting - checks.sh regenerates the Connect API pages and fails on drift from the committed spec (also validates the spec via the generator)
1a7d3a3 to
6a17604
Compare
There was a problem hiding this comment.
Pull request overview
This PR migrates the Developer Reference docs away from the legacy console.peridio.com web API/OpenAPI tooling and adds a new generated reference section for the Avocado Connect API under /developer-reference/avocado-connect-api/.
Changes:
- Removes deprecated Redocly/Redocusaurus configuration, specs, and CI linting steps associated with the legacy web API.
- Adds a committed Avocado Connect OpenAPI spec plus a generator script (
npm run build-connect-api) that produces endpoint + schema reference pages. - Integrates the new Avocado Connect API docs into the Developer Reference sidebar and adds a CI drift-check to ensure generated pages stay in sync.
Reviewed changes
Copilot reviewed 19 out of 23 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
src/src/css/custom.css |
Removes leftover Redocusaurus table styling now that Redoc-based pages are gone. |
src/sidebars-guides.js |
Adds “Avocado Connect API” category with autogenerated items under Developer Reference. |
src/scripts/build-connect-api.js |
New generator that turns the committed Connect OpenAPI spec into Docusaurus pages (per-tag grouping, examples, object references). |
src/openapi/avocado-connect-openapi.json |
Committed source OpenAPI spec used to generate the Connect API docs. |
src/docs-guides/avocado-connect-api/overview.md |
New hand-maintained overview for auth, conventions, pagination, and errors. |
src/docs-guides/avocado-connect-api/authentication-tokens.md |
Generated Connect API reference page for authentication/token endpoints. |
src/docs-guides/avocado-connect-api/devices.md |
Generated Connect API reference page for device management endpoints. |
src/docs-guides/avocado-connect-api/projects-cohorts.md |
Generated Connect API reference page for projects/cohorts and access-control endpoints. |
src/docs-guides/avocado-connect-api/runtimes.md |
Generated Connect API reference page for runtime/artifact endpoints. |
src/docs-guides/avocado-connect-api/deployments.md |
Generated Connect API reference page for deployments and rollout tracking endpoints. |
src/docs-guides/avocado-connect-api/remote-access.md |
Generated Connect API reference page for WireGuard tunnel policy/tunnel endpoints. |
src/docs-guides/avocado-connect-api/provisioning.md |
Generated Connect API reference page for claim token provisioning endpoints. |
src/docs-guides/avocado-connect-api/signing-trust.md |
Generated Connect API reference page for TUF signing/trust management endpoints. |
src/docs-guides/avocado-connect-api/events-webhooks.md |
Generated Connect API reference page for events aggregates + webhooks endpoints. |
src/docs-guides/avocado-connect-api/administration.md |
Generated Connect API reference page for admin/organization management endpoints. |
src/redocly.yaml |
Removes legacy Redocly configuration (no longer needed). |
src/openapi/peridio-device-openapi.yaml |
Removes legacy Peridio Device API OpenAPI spec. |
src/package.json |
Drops Redocly/Redocusaurus deps, adds yaml as a direct dependency, and adds the build-connect-api script. |
scripts/checks.sh |
Replaces OpenAPI linting with a generator + drift check to ensure committed Connect API docs match the spec. |
.github/workflows/build-and-deploy.yml |
Removes the Redocly lint step from CI workflow. |
Files not reviewed (1)
- src/package-lock.json: Generated file
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Emit title and description as single-quoted YAML with newlines collapsed so tag names containing ': ' or leading indicators can't break front matter parsing.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 19 out of 23 changed files in this pull request and generated no new comments.
Files not reviewed (1)
- src/package-lock.json: Generated file
Suppressed comments (2)
src/scripts/build-connect-api.js:291
- The generated curl examples set an Authorization header value that omits/obscures the required
Bearerscheme (rendered asAuthorization: ******in the generated docs). The examples should clearly show theAuthorization: Bearer <token>shape so users copy a valid header without leaking any real secret.
if (requestSample === null) {
lines.push(' -H "Authorization: Bearer $AVOCADO_TOKEN"')
} else {
lines.push(' -H "Authorization: Bearer $AVOCADO_TOKEN" \\')
lines.push(' -H "Content-Type: application/json" \\')
src/scripts/build-connect-api.js:267
sampleFromSchema()currently emits all object properties in synthesized examples. That causes response examples to include fields explicitly documented in the OpenAPI schema as “returned only on create” (e.g.,ClaimToken.token,OrgApiToken.token,WebhookEndpoint.secret), which contradicts the spec text and makes list/show examples look like they return sensitive values.
const out = {}
for (const [key, prop] of Object.entries(resolved.properties || {})) {
const value = sampleFromSchema(prop, seen, depth + 1, key)
if (value !== null) out[key] = value
}
ClaimToken.token, OrgApiToken.token, and WebhookEndpoint.secret are documented as returned only on create; synthesized list/show examples were including them. Only 201 create responses render these fields now.
9b36b00 to
3ac6513
Compare
|
Re: the two suppressed comments in Copilot's latest review:
|
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 19 out of 23 changed files in this pull request and generated 1 comment.
Files not reviewed (1)
- src/package-lock.json: Generated file
Suppressed comments (1)
src/scripts/build-connect-api.js:147
- After removing the unused
requiredByParentparameter fromflattenProperties, this call site still passes an extra[]argument and will no longer match the function signature.
flattenProperties(schema, '', [], linkable, rows, 0)
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 19 out of 23 changed files in this pull request and generated no new comments.
Files not reviewed (1)
- src/package-lock.json: Generated file
Suppressed comments (1)
src/scripts/build-connect-api.js:121
requiredByParentis never read insideflattenProperties(), and the recursive calls pass values that are also unused. This makes the signature misleading and suggests required-ness is being propagated when it isn't.
Either remove the parameter entirely (and update call sites) or, if it’s intentionally reserved for future use, prefix it with _ to make the intent explicit.
// Flatten an object schema into table rows with dotted field paths.
function flattenProperties(schema, prefix, requiredByParent, linkable, rows, depth) {
if (!schema || depth > 4) return
Dead parameter; required-ness is read from each level's own schema. Generated output unchanged.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 19 out of 23 changed files in this pull request and generated no new comments.
Files not reviewed (1)
- src/package-lock.json: Generated file
Suppressed comments (2)
src/scripts/build-connect-api.js:33
deref()assumes every$refis a resolvable local ref. If a ref is malformed or missing (or a non-#/...ref ever appears), the current loop will fail with a genericCannot read properties of undefinederror, which makes it harder to identify the broken ref when generation fails in CI. Consider validating local refs and throwing a descriptive error that includes the original$ref.
function deref(node) {
if (node && node.$ref) {
const parts = node.$ref.replace(/^#\//, '').split('/')
let target = spec
for (const part of parts) target = target[part]
scripts/checks.sh:18
git statuspathspecs are safer when separated from revisions via--(prevents edge-case ambiguity if a path looks like a rev). This also matches common Git scripting practice.
if [ -n "$(git status --porcelain docs-guides/avocado-connect-api)" ]; then
echo "error: generated Connect API docs are out of sync with the spec." >&2
echo "Run 'npm run build-connect-api' in src/ and commit the result:" >&2
git status --porcelain docs-guides/avocado-connect-api >&2
jasontwong
left a comment
There was a problem hiding this comment.
LGTM — no blocking issues found. The allOf field-drop bug and the missing CI validation (both flagged in the prior review) are fixed: checks.sh now regenerates the docs and fails on drift, and I independently ran the generator against the committed spec and confirmed the output is byte-identical. Remaining findings (union-type array label edge case, heading-slug collision guard, minor re-traversal in collectSchemaRefs) are latent/dormant — not triggered by the current spec — so treating them as non-blocking suggestions.
Description
Replaces the last remnants of the deprecated console.peridio.com web API and documents the new Avocado Connect API under Developer Reference.
Removed (legacy web API):
peridio-admin-openapi*.yaml,peridio-device-openapi.yaml) — the only remainingconsole.peridio.comreferences — plusredocly.yamlscripts/checks.sh; unusedredocusaurus/@redocly/clideps (~95 packages) and leftover.redocusaurusCSSyamlas an explicit dependency (previously only installed transitively via the removed redoc packages, but required bysync-references.js)Added (Avocado Connect API):
/developer-reference/avocado-connect-api/— overview + 10 resource-group pages covering all 76 endpoints, expanding in the sidebar like the Varlink API sectionsrc/openapi/avocado-connect-openapi.json, sourced from the connect monorepo) vianpm run build-connect-apicurlrequest and a synthesized JSON response body (spec-provided examples win; enums/formats/property-name hints fill the rest)