Arranging Endpoints by Tags

1.0.0

Following OpenAPI spec demonstrates how to arrange the paths using tags. (even though the paths are defined in random order in the spec but they are shown in the order as they are defined under tags section)

  • If there are multiple paths inside a tag, they can be further sorted. Use sort-endpoints-by property which can accept path, method, summary or none
  • If you do not want to specify tag order, but follow certain naming conventions for tags in the spec you may use sort-tags property in RapiDoc element to sort tags alphabetically
  openapi: 3.0.0
  info:
    title: Arranging by Tags
    version: 1.0.0

  tags:  # <<<<<< Define the order of the Tags using tags object at root level
    - name: The First Tag
    - name: And Second Tag
    - name: 3rd Tag

  paths:
    /path-3.1:
      get:
        summary: This path belongs to third tag
        tags:
          - 3rd Tag
    /path-1.1:
      get:
        summary: This path belongs to first tag
        tags:
          - The First Tag
    /path-2.1:
      get:
        summary: First path of 2nd Tag
        tags:
          - And Second Tag
    /path-2.2:
      get:
        summary: Second path of 2nd Tag
        tags:
          - And Second Tag
    /common-path-in-first-and-3rd-tag:
      get:
        summary: Path belongs to First and 3rd Tag
        tags:    # <<< Paths can belong to multiple Tags
          - The First Tag
          - 3rd Tag
    /no-tag/path:
      get:
        summary: This path do not have any tag