You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Provide code examples to make http requests using Stellar SDK in docs #404
For RPC documentation and Horizon documentation: we could switch all our Javascript and Python code examples to make http requests using a Stellar SDK (as opposed to general http libs like requests) and show encoding/decoding of XDR (as opposed to using opaque b64 strings)
For Horizon, this is much more easily done. I recently learned about the x-codeSamples openapi extension, and it will enable us to bake that right into the API specfile, to be generated at build/deploy time.
I don't think there is an openrpc equivelant to this, though. So, for RPC we might be out of luck for now
@janewang@ElliotFriend I created #860 to make it easier to maintain our own fork of the open-rpc-docs-react package, which is how we add those tabs to show various ways of doing the RPC calls. However, my fork does not modify the tabs or examples yet.
I'm not sure we should remove the plain-JS fetch-style examples. Seems kinda nice to show how simple it is. Maybe we could add a JS SDK tab in addition?
And as for Python—I've never used this. I guess lots of Stellar developers must? Maybe we could add another tab for Python SDK also.
The permutations over each language example expressed as SDK usage(python, js, go) per each endpoint will be a considerable effort to manually copy code samples(which should be tested) as stubs into the docs repo per each language per each endpoint. This increases the amount of maintenance to keep each SDK code sample up to date going forward related to protocol updates or sdk blasts.
Before getting deeper into the solution for achieving this, another thought which may be considered more decentralized - Can we defer to each SDK to generate its own docs and examples? Has this already been considered and/or ruled out?
Hi @sreuland 👋 I'm doing a triage pass over our open issues, and this one hasn't seen activity in a while. Two quick questions:
Is this still relevant / still on your radar?
Is there anything you need to move it forward — review, context, a decision, someone to pair with?
If it's no longer on your plate, no worries at all — just say the word and we'll open it up for other contributors. If I don't hear back in a couple weeks, I'll free up the assignment so it doesn't look claimed.
Triage bot report. This issue needs a maintainer decision.
Decision needed: does stellar-docs own SDK code examples for every API reference endpoint, or does each SDK own its own examples?
Options
Docs repo owns them. Add SDK examples for all Horizon and RPC endpoints. Highest maintenance cost.
Each SDK owns them. Close this issue and link out to the SDK docs. This is @sreuland's suggestion.
Split. Generate the RPC tabs once in the shared component. Hand-write Horizon samples for the busiest endpoints only.
Horizon: the mechanism already works
x-codeSamples is live. See openapi/horizon/components/endpoints/feeStats.yml:19.
Only 5 of 47 operations use it. 5 carry JavaScript. 2 carry Python.
Every spec change also needs pnpm api and a commit of the generated pages.
RPC: the 2024 blocker is gone
The cURL, JavaScript fetch and Python requests tabs are hardcoded in @stellar/open-rpc-docs-react, at src/ExamplePairing/ExamplePairing.tsx:62-83.
The OpenRPC spec cannot add tabs. Nothing in that package reads a code-samples field.
SDF now owns that package. One change there gives SDK tabs on all 12 method pages at once. @ElliotFriend, this removes the constraint you named in 2024.
Today only 3 of 12 method pages carry hand-written SDK examples.
Two smaller choices inside option 1 or 3
Replace the plain HTTP examples, or keep them and add an SDK tab? The issue says replace. @chadoh asked to keep them.
Which languages: JavaScript, Python, Go?
Related:#441 asks the same question for RPC and is also open. Please settle both together.
Separate small defect I found: openapi/horizon/components/endpoints/paths.yml:42 installs the deprecated stellar-sdk package, while its own label says @stellar/stellar-sdk. I can send that one-line fix as its own PR on request.
Activity
[Soroban Merge] Create a "Smart Contracts" section (stellar#388)
ElliotFriend commentedon Jun 20, 2024
For Horizon, this is much more easily done. I recently learned about the
x-codeSamplesopenapi extension, and it will enable us to bake that right into the API specfile, to be generated at build/deploy time.I don't think there is an openrpc equivelant to this, though. So, for RPC we might be out of luck for now
build: fork, don't patch, open-rpc-docs-react
chadoh commentedon Aug 2, 2024
@janewang @ElliotFriend I created #860 to make it easier to maintain our own fork of the
open-rpc-docs-reactpackage, which is how we add those tabs to show various ways of doing the RPC calls. However, my fork does not modify the tabs or examples yet.I'm not sure we should remove the plain-JS
fetch-style examples. Seems kinda nice to show how simple it is. Maybe we could add aJS SDKtab in addition?And as for Python—I've never used this. I guess lots of Stellar developers must? Maybe we could add another tab for
Python SDKalso.janewang commentedon Aug 6, 2024
We are going publish the npm package
janewang commentedon Aug 13, 2024
Need to publish the npm package
build: fork, don't patch, open-rpc-docs-react (#1053)
sreuland commentedon Mar 11, 2025
Considering the large amount of content across the API docs:
The permutations over each language example expressed as SDK usage(python, js, go) per each endpoint will be a considerable effort to manually copy code samples(which should be tested) as stubs into the docs repo per each language per each endpoint. This increases the amount of maintenance to keep each SDK code sample up to date going forward related to protocol updates or sdk blasts.
Before getting deeper into the solution for achieving this, another thought which may be considered more decentralized - Can we defer to each SDK to generate its own docs and examples? Has this already been considered and/or ruled out?
mollykarcher commentedon Mar 12, 2025
@sreuland there's some related discussion on this as well over on this issue - #441 (comment)
ElliotFriend commentedon Jul 13, 2026
Hi @sreuland 👋 I'm doing a triage pass over our open issues, and this one hasn't seen activity in a while. Two quick questions:
If it's no longer on your plate, no worries at all — just say the word and we'll open it up for other contributors. If I don't hear back in a couple weeks, I'll free up the assignment so it doesn't look claimed.
kaankacar commentedon Sep 7, 2026
Triage bot is looking at this issue.
I am checking the live docs and the build setup. I will report back.
kaankacar commentedon Sep 7, 2026
Triage bot report. This issue needs a maintainer decision.
Decision needed: does stellar-docs own SDK code examples for every API reference endpoint, or does each SDK own its own examples?
Options
Horizon: the mechanism already works
x-codeSamplesis live. Seeopenapi/horizon/components/endpoints/feeStats.yml:19.pnpm apiand a commit of the generated pages.RPC: the 2024 blocker is gone
fetchand Pythonrequeststabs are hardcoded in@stellar/open-rpc-docs-react, atsrc/ExamplePairing/ExamplePairing.tsx:62-83.Two smaller choices inside option 1 or 3
Related: #441 asks the same question for RPC and is also open. Please settle both together.
Separate small defect I found:
openapi/horizon/components/endpoints/paths.yml:42installs the deprecatedstellar-sdkpackage, while its own label says@stellar/stellar-sdk. I can send that one-line fix as its own PR on request.@kaankacar @ElliotFriend