Skip to content

GitLab Next

  • Menu
Projects Groups Snippets
    • Loading...
  • 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 39,511
    • Issues 39,511
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 1,222
    • Merge requests 1,222
  • Requirements
    • Requirements
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Metrics
    • Incidents
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Analytics
    • Analytics
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
    • Value stream
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • GitLab.org
  • GitLabGitLab
  • Issues
  • #16023

Closed
Open
Created Sep 27, 2016 by Achilleas Pipinellis@axil🐸Maintainer0 of 2 tasks completed0/2 tasks

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)
  • https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/2397
Edited Jul 02, 2020 by Achilleas Pipinellis
Assignee
Assign to
Time tracking