Skip to content
GitLab
Next
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • GitLab GitLab
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 44,761
    • Issues 44,761
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
    • Requirements
  • Merge requests 1,332
    • Merge requests 1,332
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Container Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Metrics
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • GitLab.orgGitLab.org
  • GitLabGitLab
  • Issues
  • #16023
Closed
Open
Issue created Sep 27, 2016 by Achilleas Pipinellis@axil👶Maintainer0 of 2 checklist items completed0/2 checklist items

Use the OpenAPI specification for the API docs

Formerly known as Swagger, OpenAPI is an initiative to standardize the way an API is documented.

Useful blog post series that describe the swagger 2.0 behavior http://apihandyman.io/writing-openapi-swagger-specification-tutorial-part-1-introduction/

Tools for generating HTML pages

There are two nice tools that provide the 3-column page we all know and love:

  • https://github.com/Rebilly/ReDoc
  • https://github.com/technekes/grape-slate
  • How Mattermost does this: Specification is written manually in multiple yaml files and then redoc is used to build the site that eventually lives in https://api.mattermost.com/. There are ways to automatically generate a json file out of our grape API, will need to investigate if it is enough.

Proof of concept

Visit: https://axil.gitlab.io/swaggerapi/

From https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/2397#note_25057321

I created a PoC based on the json export me and used https://github.com/Rebilly/ReDoc which is what Mattermost is using . The result is https://axil.gitlab.io/swaggerapi/, but it takes ages to load. That was the best interface I could find that would easily convert our openapi json export in readable API docs. A drawback is that is generates non-friendly URLs like https://axil.gitlab.io/swaggerapi/#operation/putV3GroupsId.

Issues to resolve

  • We still provide a lot more information in our markdown docs than the Grape API descriptions, and there are also relative links pointing to other API docs.
  • The generated HTML is one page, whereas the current API docs are split in multiple docs. We'd have to redirect whole pages to anchor links. Again, not sure how clean those new URLs will look like. The question is how will we replace https://docs.gitlab.com/ce/api/ and https://docs.gitlab.com/ee/api/ without breaking links?

Relevant issues/MRs

  • gitlab-foss#20070 (closed)
  • gitlab-foss!2397 (closed)
Edited Feb 23, 2022 by Achilleas Pipinellis
Assignee
Assign to
Time tracking