Skip to content

feat: add javascript sdk generated from the same schemas - #2

Open
taimoor-ahmed-1 wants to merge 1 commit into
masterfrom
feat/js_sdk
Open

taimoor-ahmed-1 wants to merge 1 commit into
masterfrom
feat/js_sdk

Conversation

@taimoor-ahmed-1

@taimoor-ahmed-1 taimoor-ahmed-1 commented Sep 17, 2026 •

Copy link
Copy Markdown

Adds a JavaScript/TypeScript SDK, generated from the same schemas as the Python one.

  • javascript/ package, generated with @hey-api/openapi-ts into src/generated/, which is committed the way the Python package is
  • regen_sdk_js.sh mirrors regen_sdk.sh and reuses filter_schema.py, so both SDKs cover the same openedx-platform-sdk tagged operations
  • src/auth.ts is hand-written and mirrors auth.py: OAuth2 client_credentials, JWT prefix, auto refresh, getStudioClient() / getLmsClient()
  • regenerate_sdk.yml now regenerates both SDKs in the weekly run
  • Python package is untouched

Generated from the schemas now committed at docs/ in the platform: 16 paths, 27 components, 23 operations. Rerunning the generator reproduces src/generated/ byte for byte, so the weekly workflow only opens a PR on real schema changes.

Verified: typecheck, eslint, 7 auth tests, and the dual CJS/ESM build all pass.

Two things worth a look:

  • The generator inlines its own axios client, so @hey-api/client-axios is gone and axios is the only runtime dependency. createClient is re-exported for MFEs that already hold an authenticated axios instance.
  • engines.node is >=20, which the generator requires.

🤖 Generated with Claude Code

Adds a javascript/ package generated with @hey-api/openapi-ts from the
filtered schema that filter_schema.py already produces for the python SDK,
plus a hand-written OAuth2 client-credentials helper mirroring auth.py.
regen_sdk_js.sh mirrors regen_sdk.sh and the weekly workflow regenerates both.

src/generated/ is committed, matching how the python package is handled.
The generator inlines its own axios client, so axios is the only runtime
dependency and createClient is re-exported for MFEs that already have an
authenticated axios instance.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@taimoor-ahmed-1
taimoor-ahmed-1 changed the base branch from feat/implement_sdk to master October 6, 2026 09:09
@Faraz32123

Copy link
Copy Markdown
Collaborator

Heads-up: the Python SDK now resolves calls from the service root (#3) — generated paths carry their own /api/... prefix. auth.ts here still expects studioUrl to include /api/contentstore and appends /api/enrollment for LMS, so it'll double-prefix once this branch is regenerated against #3. The matching change is to treat both URLs as service roots.

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