Skip to content

Dna docs improvements - #241

Merged
camerontarget14 merged 7 commits into
mainfrom
dna-docs-improvements
Oct 22, 2026
Merged

camerontarget14 merged 7 commits into
mainfrom
dna-docs-improvements

Conversation

@camerontarget14

@camerontarget14 camerontarget14 commented Oct 22, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Makes the backend API usable by someone outside the project (e.g. a ShotGrid or AYON tooling developer) without reading the source. The OpenAPI document now documents itself, and the docs site gets hand-written guide pages around the generated reference.

Backend (spec is self-documenting; /docs, /redoc and the site all benefit)

  • New dna/openapi_schema.py layers onto the generated spec:
    • x-tagGroups splitting endpoints into Production Tracking (proxy the provider; DNA stores nothing) and DNA (DNA's own storage).
    • A description on every opaque-ID parameter (project_id, version_id, user_email, ...), injected centrally.
    • A uniform 401 on every authenticated operation, and an error_responses() helper so routes declare the 4xx/5xx they raise. All error bodies reference a new ErrorResponse model ({"detail": ...}).
  • main.py: API description and every tag description rewritten to say what proxies the tracking provider vs. what DNA stores. New Publishing and Project Glossary tags; glossary/publish routes retagged. Longer descriptions on publish-notes, draft PUT, find, generate-note, run-qc-checks.
  • json_schema_extra examples on ~50 schemas, all using one fictional production (project 124, version mk020_0010_comp_v003, sam.reviewer@studio.example) so examples agree across endpoints.
  • test_openapi_spec.py now asserts: every tag is in exactly one group, every secured op has a 401, every parameter is described, every documented error body is ErrorResponse. These fail if a route is added without documenting it, which is the point.

Docs site

  • Spec copy was three weeks stale (integer IDs, missing endpoint). npm run build:full now runs fetch-openapi first so it cannot drift again.
  • Hand-written Authentication, Concepts, Errors and Real-time pages (the last covers the /ws and extension-ingest WebSockets, which are not in OpenAPI). Landing page rewritten as a first-request walkthrough.
  • Reference sidebar grouped by tag group.
  • API explorer code samples trimmed to cURL, Python, JavaScript, C, Rust, Go; bash Prism grammar loaded so shell blocks highlight.

Caught up with main (merged in twice; one README conflict resolved in favour of the fetch-openapi build step)

Testing

  • I have tested these changes locally
  • I have run all relevant automated tests
  • I have verified this does not break existing workflows
  • For changes that can be tested in UI, I have included screenshots or gif animations of the changes.

How I Tested

  1. cd backend && .venv/bin/python scripts/export_openapi.py — regenerated docs/openapi.json from the merged code (41 paths, 58 schemas).
  2. .venv/bin/python -m pytest tests/test_openapi_spec.py tests/test_user_settings.py tests/test_transcription_languages_endpoint.py — 39 passed, including the new spec guards and the drift test.
  3. cd dna-docs && npm run build:full — fetch, regenerate and build succeed with onBrokenLinks: 'throw'.
  4. The API explorer renders examples client-side, so I decoded the zlib+base64 api: front matter of the generated api/reference/*.api.mdx for publish-notes, transcription/bot, transcription/languages and user-settings PUT, and confirmed the new descriptions, examples (language: "en", transcription_language: "en", Zoom second example) and error statuses are present.

🤖 Generated with Claude Code

camerontarget14 and others added 7 commits October 19, 2026 10:09
Signed-off-by: Cameron Target <camerontarget@gmail.com>
Backend (spec is now self-documenting; /docs, /redoc and the site all
benefit):
- Add dna/openapi_schema.py: x-tagGroups ("Production Tracking" vs
  "DNA"),
  descriptions for every opaque-ID parameter, uniform 401 on
  authenticated
  routes, and error_responses() for per-route 4xx/5xx docs
- Add ErrorResponse model for the {"detail": ...} envelope
- Rewrite API description and tag descriptions to say what proxies the
  tracking provider vs. what DNA stores; add Publishing and Project
  Glossary
  tags and retag the glossary/publish routes
- Document error statuses on every route that raises them; expand the
  descriptions of publish-notes, draft PUT, find, generate-note,
  run-qc-checks
- Add json_schema_extra examples to 48 schemas using one consistent
  fictional
  production
- Extend test_openapi_spec.py: tags grouped exactly once, 401 on secured
  ops,
  all params described, error bodies use ErrorResponse
- Regenerate docs/openapi.json

Docs site:
- Refresh the stale spec copy (was 2026-09-28: integer IDs, missing
  endpoint)
  and make build:full run fetch-openapi so it cannot drift again
- Group the reference sidebar by tag group
- Add hand-written Authentication, Concepts, Errors and Real-time pages
  (incl. the /ws and extension-ingest WebSockets, which are not in
  OpenAPI)
- Rewrite the landing page with a first-request walkthrough
- Trim API explorer code samples to cURL, Python, JavaScript, C, Rust,
  Go;
  load the bash Prism grammar so shell blocks highlight
- Update README and contributing guide to match the fetch script

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Signed-off-by: Cameron Target <camerontarget@gmail.com>
Signed-off-by: Cameron Target <camerontarget@gmail.com>
main landed #224 (Zoom bots) and #233 (notes link to their transcript)
ahead of this branch, so after merging main:

- DispatchBotRequest gets a second example showing a Zoom dispatch, and
  POST /transcription/bot says Zoom needs meeting_url with the passcode
  only honoured as the link's pwd
- publish-notes description and the Concepts page now say the Note is
  linked to the version's newest transcript row (best effort), and the
  Concepts walkthrough publishes the transcript before the notes
- Regenerate both openapi.json copies
- Drop backend/docs/API_DOCS_MAINTENANCE.md; it was a merge-ordering
  guide for PRs that have now merged

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Signed-off-by: Cameron Target <camerontarget@gmail.com>
Signed-off-by: Cameron Target <camerontarget@gmail.com>

# Conflicts:
#	dna-docs/README.md
- transcription_language in the user-settings request and response
  examples; User Settings tag description mentions it
- DispatchBotRequest.language described as an ISO 639-1 code from
  GET /transcription/languages, with "en" in the Google Meet example
- TranscriptionLanguagesResponse gets an example and the languages
  route documents its 400
- Concepts step 5 notes the web app fills language from the reviewer's
  settings, so other tools should pass it explicitly
- Regenerate both openapi.json copies

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Signed-off-by: Cameron Target <camerontarget@gmail.com>
@camerontarget14
camerontarget14 merged commit 8df0a00 into main Oct 22, 2026
4 checks passed
@camerontarget14
camerontarget14 deleted the dna-docs-improvements branch October 22, 2026 23:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants