mistaguy/ment

View on GitHub
src/api/docs/swagger.json

Summary

Maintainability
Test Coverage
{
  "swagger": "2.0",
  "info": {
    "version": "1.0.0",
    "title": "Ment API",
    "description": "Ment API",
    "license": {
      "name": "Apache License, Version 2.0",
      "url": "https://opensource.org/licenses/Apache-2.0"
    }
  },
  "host": "localhost:3000",
  "basePath": "/api/v1",
  "tags": [
    {
      "name": "Users",
      "description": "API for users in the system"
    }
  ],
  "schemes": [
    "http"
  ],
  "consumes": [
    "application/json"
  ],
  "produces": [
    "application/json"
  ],
  "securityDefinitions": {
    "jwt": {
      "type": "apiKey",
      "in": "header",
      "name": "Authorization"
    }
  },
  "security": [
    {
      "jwt": []
    }
  ],
  "paths": {
    "/user": {
      "post": {
        "tags": [
          "Users"
        ],
        "description": "Create new user in system",
        "parameters": [
          {
            "name": "user",
            "in": "body",
            "description": "User that we want to create",
            "schema": {
              "$ref": "#/definitions/User"
            }
          }
        ],
        "produces": [
          "application/json"
        ],
        "responses": {
          "200": {
            "description": "New user is created",
            "schema": {
              "$ref": "#/definitions/User"
            }
          }
        }
      },
      "get": {
        "tags": [
          "Users"
        ],
        "summary": "Get all users in system",
        "responses": {
          "200": {
            "description": "OK",
            "schema": {
              "$ref": "#/definitions/Users"
            }
          }
        }
      }
    },
    "/user/{userId}": {
      "parameters": [
        {
          "name": "userId",
          "in": "path",
          "required": true,
          "description": "ID of user that we want to find",
          "type": "string"
        }
      ],
      "get": {
        "tags": [
          "Users"
        ],
        "summary": "Get user with given ID",
        "responses": {
          "200": {
            "description": "User is found",
            "schema": {
              "$ref": "#/definitions/User"
            }
          }
        }
      },
      "delete": {
        "summary": "Delete user with given ID",
        "tags": [
          "Users"
        ],
        "responses": {
          "200": {
            "description": "User is deleted",
            "schema": {
              "$ref": "#/definitions/User"
            }
          }
        }
      },
      "put": {
        "summary": "Update user with given ID",
        "tags": [
          "Users"
        ],
        "parameters": [
          {
            "name": "user",
            "in": "body",
            "description": "User with new values of properties",
            "schema": {
              "$ref": "#/definitions/User"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "User is updated",
            "schema": {
              "$ref": "#/definitions/User"
            }
          }
        }
      }
    }
  },
  "definitions": {
    "User": {
      "required": [
        "username",
        "password"
      ],
      "properties": {
        "username": {
          "type": "string",
          "uniqueItems": true
        },
        "password": {
          "type": "string",
          "uniqueItems": true
        }
      }
    },
    "Users": {
      "type": "array",
      "$ref": "#/definitions/User"
    }
  }
}