Add examples to api documentation #219
Labels
No labels
area: devops
area: discovery
area: docs
area: livestream
area: proposal
consider soon
Epic
good first issue
hacktoberfest
hard fork
help wanted
icebox
Invalid
level: 0
level: 1
level: 2
level: 3
level: 4
needs: exploration
needs: grooming
needs: priority
needs: repro
needs: tech design
on hold
priority: blocker
priority: high
priority: low
priority: medium
resilience
soft fork
Tom's Wishlist
type: bug
type: discussion
type: improvement
type: new feature
type: refactor
type: task
type: testing
unplanned
work in progress
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: LBRYCommunity/lbrycrd#219
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
To add onto https://github.com/lbryio/lbrycrd/pull/187 and fulfill https://github.com/lbryio/lbry.tech/issues/139, can we generate example calls for each command?
Noting here that there are example calls for commands but it is not being parsed properly
@tzarebczan , it's not clear (looking at the parent bug) whether you want command-line examples for this or JSON RPC examples.
Other thoughts: the current "example" sections in the API docs came from the embedded help text in the lbrycrd RPC methods. They are for the command line tool, and they are not consistent in their formatting or in their inclusion on every RPC method. Most of the RPC methods come from pre-existing bitcoin code. I'm hesitant to change that code as it complicates our merge with upstream changes.
Providing examples of how to run the commands via
cURL
or by directly running the CLI tool both make sense.If I had to pick one, I'd probably say
cURL
, but this is not a particularly reasoned opinion. Ideally, we could just provide both or even more versions (see Stripe API for an example of how this is done well).When I looked at the existing docs, it looked like it frequently contained both. Would it be feasible to parse to a structure like this?
@NetOperatorWibby nothing for you here yet I think, but tagging you so you can follow this ticket.
@BrannonKing - the SDK team went ahead with the below output format for examples. I think LBRYcrd should be able to do something similar. Lex's plan is to execute these and grab outputs interactively via unit tests.
https://gist.github.com/tzarebczan/1af2e79ba365a006d1b1f0079a3cb03c
https://github.com/lbryio/lbry/pull/1790
I fixed the generator to include an examples field. It will populate it if the existing RPC had examples specified in its CLI help. I've checked in the new generator and the new api_v1.json file, but I have not gone through and added example sections to our claimtrie calls.
@NetOperatorWibby , what do I need to do to close this ticket?
@BrannonKing lbry.tech reads the json from here: https://github.com/lbryio/lbrycrd/blob/add_api_docs_scripts/contrib/devtools/generated/api_v1.json
(
b6b274aa32/app/components/edit-link.js
)Sounds like this link may need to be updated?
@BrannonKing You may be all set. I'll test it in tech first.
So, looks like JSDelivr has a cached version of the api json file so I had to email them to get it purged. No idea how long that's gonna take. Until they finish their purge tool, we'll have to keep emailing them with purge requests.
Another options is to version the compiled JSON file inside the
generated
folder.Something weird is happening. Just realized I'm seeing the examples rendered inside of the description.
How do I version it? When I pull up https://github.com/lbryio/lbrycrd/blob/master/contrib/devtools/generated/api_v1.json I see that "Unlock the wallet" is correct.
By "version", I was thinking of doing something like
/generated/0.1.0/api.json
. However, I don't think that is necessary at this time since I am seeingexamples
, they are merged withdescription
for some reason.They were merged with description before I changed it a month ago. You're seeing an old version of the api_v1.json file.
https://cdn.jsdelivr.net/gh/lbryio/lbrycrd@master/contrib/devtools/generated/api_v1.json is still showing examples inside the description.
My email got a response from JSDelivr and I ran the curl command to purge twice. Still no change in the link above though. Maybe we just have to wait. I'll come back to this tomorrow.
I have no idea how to update jsdelivr.net or why you might be pulling resources from there. I don't see why that would keep this issue open.
This seems like it's in @NetOperatorWibby's court at this point.
Could the examples match what the SDK API file is doing? https://github.com/lbryio/lbry/blob/master/docs/api.json#L49-L57
Done enough for now.