feat: new sdk reference page with snippets#2552
Conversation
Replaces the auto-generated axios/curl examples in the OpenAPI reference with idiomatic snippets pulled directly from the Ory SDK clients (@ory/client TypeScript and client-go). - Add scripts/inject-sdk-code-samples.mjs: reads TypeScript request interfaces from the TS SDK and Go examples from the pre-generated docs in the Go SDK (sdk/clients/client/go/docs/), then writes x-codeSamples into src/static/api.json for all 149 operations - Configure docusaurus.config.ts: add TypeScript and Go language tabs with correct codeSampleLanguage matching; include all Postman languages for the interactive explorer - Swizzle CodeSnippets and CodeTabs theme components to guard against empty variants arrays crashing <Tabs> - Regenerate docs/reference/openapi/ MDX from the updated spec Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
# Conflicts: # src/static/rate-limits.json
zepatrik
left a comment
There was a problem hiding this comment.
Some of the colors don't work well with light mode.
I was also able to crash the page when switching to python.
Additionally, as a user I'd want to have a very good search on that page where I can:
- free text say what I want to do, e.g. "create identity" or "import identity"
- search by the SDKs method, e.g. "createIdentity"
We might not do the search right away, but IMO we should have it soon.
unatasha8
left a comment
There was a problem hiding this comment.
I still see the links "OpenAPI introduction" for example: https://docs-g60jtzv0z-ory.vercel.app/docs/sdk/new?language=go
docs-g60jtzv0z-ory.vercel.appOry Network SDK Reference | OryIndex of REST operations from the generated OpenAPI docs, grouped by tag.[6:04 PM]How about replacing this text: "Use the links below to jump to a specific operation, or start from the OpenAPI introductionm" with this instead "Use the links below to jump to a specific operation or use the search bar to find an operation."
Summary
Adds a new SDK reference page to the API docs, initially for Python, Go, and TypeScript.
Each operation now shows real, copy-pasteable SDK snippets (generated from the Ory SDKs) alongside cURL, instead of only auto-generated HTTP examples.
How it works
x-codeSamplesentries on each operation.scripts/inject-sdk-code-samples.mjsreads the generated Ory SDKs from the siblingory/sdkrepo and injects the Python, Go, and TypeScript samples into api.json:Open questions
Right now the SDK samples are injected manually. We should automate this eg. the same way we currently update: