Skip to content

Create OpenAPI/swagger 3.0.0 documentation

On SwaggerHub you can verify your Swagger or OpenAPI documentation created manually or by an automation.

1. OpenAPI Specification

This is the documentation which was created manually. Just get a bit familiar with the documentation.

  • YAML
openapi: 3.0.0
info:
  version: v1
  title: assistant-extension API for a Node.js application
  description: Assistant-extension API for a Node.js application documentation to be integrated with Watson Assistant.

servers:
  - description: Code Engine application
    url: https://YOUR_APPLICATION_URL/v1

security:
  - basicAuth: []

paths:
  /getmessage:
    get:
      description: Returns a simple message
      responses:
        '200':
          description: 200 message returned
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
        '401':
          description: 401 Access denied
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
components:
  securitySchemes:
    basicAuth:
      type: http
      scheme: basic
  • JSON
{
  "openapi": "3.0.0",
  "info": {
    "title": "assistant-extension API for a Node.js application",
    "version": "v1",
    "description": "Assistant-extension API for a Node.js application documentation to be integrated with Watson Assistant."
  },
  "servers": [
    {
      "url": "https://YOUR_APPLICATION_URL/v1",
      "description": "Code Engine application"
    }
  ],
  "security": [
     {"basicAuth":[]}
  ],
  "paths": {
    "/getmessage": {
      "get": {
        "description": "Returns a simple message",
        "responses": {
          "200": {
            "description": "200 message returned",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "401 Access denied",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "basicAuth" : {
        "type": "http",
        "scheme": "basic"
      }
    }
  }
}