• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

kirkstrobeck/blueprint-docify: Autogenerate API blueprint documentation with CI ...

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称:

kirkstrobeck/blueprint-docify

开源软件地址:

https://github.com/kirkstrobeck/blueprint-docify

开源编程语言:

Shell 56.9%

开源软件介绍:

Blueprint docify

Autogenerate testable and pretty API docs

TL;DR

Add your API spec as api.apib in the root of your repo and push!

It will make great API docs for each branch that has an API blueprint (.apib). Your documents will be available at http://org.github.io/repo/branch. See the branches on this repo and thier related docs:

These are for visual purposes only, do not read as spec

Getting started

  1. Login to Github as yourself

  2. Create a team on your organization named apibot with admin access to the repos you want to docify. This team will help to limit access by being intentional about what repos are added. ie. renewableapibot for this repo.

  3. Create a new Github account for your api bot (ie. renewableapibot). If you're using Google email, append the first part of your email with +bot, like [email protected] so you can verify your account, which is a prerequisite to publishing Github pages.

  4. Create the orphan branch gh-pages on your repo.

  • Use git checkout --orphan gh-pages
  • Delete all of the files in the directory (except .git obviously)
  • Add an empty file with the name .gitignore. (run touch .gitignore)
  • Commit, then push to gh-pages with git push --set-upstream origin gh-pages
  1. Login to Github as the bot

  2. Create a new Shippable account as the bot (login with Github). Add your repo on the settings page.

  3. Copy the Shippable deployment key and add it as an SSH key in Github (not under the repo, under the bot’s account).

Equip your repo

  1. Login to Github as yourself

  2. Pull down this repo and copy the following files to the repo you want to equip:

    blueprint-docify
    package.json
    shippable.yml

    If you already have a package.json then run the following:

    npm install [email protected] --save
    npm install [email protected] --save
    npm install [email protected] --save
    npm install [email protected] --save
  3. Modify line 63 of blueprint-docify/compile_docs.sh in the repo you want to equip.

Now, because of shippable.yml, you should be ready to rock. Shippable should build out your API documentation on push. If you don’t want to run Shippable on a specific push, include [skip ci] in your commit message.

Why it was made

API blueprint is a great new flavor of Markdown for clear API spec. We were using Apiary for a bit, it’s a great place to get started with apib, but it fell short as a production-ready tool for any stack.

Problems with Apiary or any other tool like it:

  • No way to signify if the response or endpoint is a hopeful mock, old and should be deleted, in production, in beta, wont do, etc.
  • Can’t test against API spec with custom conditional notes, etc. What stage is each endpoint, etc.
  • Maintain n number of apiary’s per-branch * per-repo * per-org where n is way too many (more than 1). Where is the documentation with these links? How do you handle elegant naming conventions when it is a shared namespace, ie. http://docs.notelegant.apiary.io/
  • It’s is slow, sometimes down, etc. (it’s another external dependency)
  • Is Github our source of truth? or where do I look? Is that up to date? Where’s the changelog!
  • Please show me the diff between this API and that one (different branches)
  • Apiary only lets me write one file per repo! I have other branches, each with a unique API spec, because the API is in development!

FAQ

Q: Can a private repo write a public Github page? Private repos will write public pages :D

Q: So how does this publish multiple branches docs at once? multiple github pages? It actually pulls gh-pages from your repo to the CI and overwrites the folder with the name of the branch you are pushing to the CI from

Q: So one rendered branch at a time? Yah, when you update an api spec and push, it writes the docs for that branch

Q: What if there’s already an api bot on my repo? If you already have an api bot in your Github organization (someone else followed these steps already), then simply give it access to the required repo(s) and try to add it to the same CI account (doesn’t make sense to spread out CI implementations).

Q: What is this API I see in the examples? We used the example API blueprint from API Blueprint Examples

Q: how many emails you'll get? I believe its just for the Github account confirmation. if the email is in the bot’s public profile on Github, Shippable will grab it and use that email for pass/fail messages.

Roadmap

Thank you!




鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
punchcode-fullstack/21-github-api-profile发布时间:2022-06-11
下一篇:
mingjunli/GithubTrending: Github trending restful API发布时间:2022-06-11
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap