-
Notifications
You must be signed in to change notification settings - Fork 42
Creating code samples from OpenAPI schema data #484
Comments
I had to prefix The code examples work for JS should work, you can see it rendered at https://octokit-routes-openapi.now.sh. The challenge with that approach is that all SDKs need to have the new endpoints implemented before the REST API docs gets published. And even then it would be helpful to know which version of the SDK introduced the new method. Maybe the code examples should live in the repositories of the respective SDKs and then be pulled in from there into the central developer docs? |
yeah...and in ruby, for example, PascalCase is used for modules/classes and snake_case for methods...so Octokit::Client::Pulls.create_comment_reply although currently it's actually: Octokit::Client::PullRequests.create_pull_request_comment_reply
Octokit::Client::PullRequests.create_pull_reply #alias
Octokit::Client::PullRequests.create_review_reply #alias for reference, the current non- |
and i like the idea of sdk maintainers being responsible for the code that generates the examples...but perhaps it stays in this repo like:
and the function signatures could be something like: function toExample ({ route, scope, baseUrl }) {
// insert unholy js written by non-jsers ;P
return {
sdk: {
name,
url,
...
},
infoString, // code fence info string
// ^ https://github.github.com/gfm/#example-112
// https://github.com/github/linguist/blob/master/vendor/README.md
codeString
}
} |
It looks like they're all currently rendering as
Are scopes always a single word? If so, I suppose it's easy enough to assemble a method by extracting the first part before the hyphen. My suggestion is not about a specific capitalization preference, but more a clear way to differentiate the scope from the function name. I feel it's easier to derive |
Ooopsiedooopsie
Not quite, there is
Sure why not, I don't like the current mix of underscores and dashes |
In #168, a new OpenAPI schema landed in this project, and will pave the way for a future where all the octokits have a shared schema! ❤️
Today I was inspecting the contents of the openapi/api.github.com/operations directory, and noticed that
operationId
values are all in snake-case format:It looks like these values are currently created by joining the
scope
and theendpoint.idName
with a hyphen:routes/lib/openapi.js
Line 193 in 261c763
I also noticed that there's already some code in this project for creating example code with
toShellExample
andtoJsExample
:routes/lib/openapi.js
Line 261 in 261c763
This leads me to a few questions:
toJsExample
my guess is no:routes/lib/openapi.js
Line 269 in 261c763
operationId
values that more closely match the method names octokit clients will use? For example, I'd suggest thatpulls-create-comment-reply
should instead bepulls.createCommentReply
I'm happy to help out on this, but wanted to open this issue first to discuss and get a sense of where things are with this effort before jumping to an implementation.
cc @gr2m @d11n
The text was updated successfully, but these errors were encountered: