3

If I have a doc/api endpoint that should point to the current swagger doc, how should the self-referring be done for Swagger with OpenAPI 3.0.0?

For example, given

openapi: 3.0.0
servers:
  - url: http://hello-world.com
info:
  description: |-
    Hello World!
  version: "4"
  title: Hello World

components:
  schemas:
    SwaggerDoc:
      type: object
      properties:
        address:
          $ref: '#/components/schemas/SwaggerDoc'

paths:
  /docs/api:
    get:
      summary: Swagger Documentation (HTML)
      tags:
        - Service Information
      responses:
        '200':
          description: HTML Document of RIT Translate API
          content:
            'text/html':
              schema:
                $ref: '#/components/schemas/SwaggerDoc'
        '503':
          description: The server is not ready.

And the output from https://editor.swagger.io shows:

enter image description here

On the right of the response section under Links, it shows "No links`. Is it possible to add the link to link to self under that link?

And for the 503, how should I link it to another static error page?

alvas
  • 115,346
  • 109
  • 446
  • 738

0 Answers0