Skip to content

Instantly share code, notes, and snippets.

@nartc
Created December 25, 2017 20:23
Show Gist options
  • Save nartc/4cb5fb53493badbf36b5ffb86597d945 to your computer and use it in GitHub Desktop.
Save nartc/4cb5fb53493badbf36b5ffb86597d945 to your computer and use it in GitHub Desktop.
swagger.json
{
"swagger": "2.0",
"info": {
"version": "1.0.0",
"title": "HelpDeskTMF",
"description": "HelpDeskTMF OpenAPI Documentations"
},
"host": "localhost:3000",
"basePath": "/",
"tags": [
{
"name": "Users",
"description": "Users Routes"
}
],
"schemes": [
"http",
"https"
],
"securityDefinitions": {
"JWT": {
"type": "apiKey",
"name": "Authorization",
"in": "header"
}
},
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"paths": {
"/users/login": {
"x-swagger-router-controller": "UserController",
"post": {
"description": "Login User",
"operationId": "login",
"tags": [
"Users"
],
"parameters": [
{
"$ref": "#/parameters/LoginBody"
}
],
"responses": {
"200": {
"description": "Successfully Logged In",
"schema": {
"$ref": "#/definitions/LoginResponse"
}
},
"default": {
"description": "Error",
"schema": {
"$ref": "#/definitions/DefaultResponse"
}
}
}
}
},
"/users/register": {
"x-swagger-router-controller": "UserController",
"post": {
"description": "Regiser User",
"operationId": "registerUser",
"tags": [
"Users"
],
"parameters": [
{
"$ref": "#/parameters/NewUserBody"
}
],
"responses": {
"200": {
"description": "Successfully init new User",
"schema": {
"$ref": "#/definitions/GeneralResponse"
}
},
"default": {
"description": "Error",
"schema": {
"$ref": "#/definitions/DefaultResponse"
}
}
}
}
},
"/users/verify": {
"x-swagger-router-controller": "UserController",
"post": {
"description": "Verify new User",
"operationId": "verifyUser",
"tags": [
"Users"
],
"parameters": [
{
"$ref": "#/parameters/VerifyUserBody"
},
{
"name": "token",
"in": "query",
"description": "Verify User Query Body",
"type": "string"
}
],
"responses": {
"200": {
"description": "Successfully verify User",
"schema": {
"$ref": "#/definitions/GeneralResponse"
}
},
"default": {
"description": "Error",
"schema": {
"$ref": "#/definitions/DefaultResponse"
}
}
}
}
},
"/users/change-password": {
"x-swagger-router-controller": "UserController",
"put": {
"description": "Change User Password",
"operationId": "changePassword",
"security": [
{
"JWT": [
]
}
],
"tags": [
"Users"
],
"parameters": [
{
"$ref": "#/parameters/ChangePasswordBody"
}
],
"responses": {
"200": {
"description": "Successfully changed password",
"schema": {
"$ref": "#/definitions/ChangePasswordResponse"
}
},
"default": {
"description": "Error",
"schema": {
"$ref": "#/definitions/DefaultResponse"
}
}
}
}
},
"/users/forgot-password": {
"x-swagger-router-controller": "UserController",
"post": {
"description": "Forgot Password",
"operationId": "forgotPassword",
"tags": [
"Users"
],
"parameters": [
{
"name": "ForgotPasswordBody",
"in": "body",
"description": "Forgot Password Params Body",
"required": true,
"schema": {
"properties": {
"email": {
"type": "string"
}
}
}
}
],
"responses": {
"200": {
"description": "Successfully Requested new password",
"schema": {
"$ref": "#/definitions/GeneralResponse"
}
},
"default": {
"description": "Error",
"schema": {
"$ref": "#/definitions/DefaultResponse"
}
}
}
}
},
"/swagger": {
"x-swagger-pipe": "swagger_raw"
}
},
"definitions": {
"LoginResponse": {
"properties": {
"responseInfo": {
"$ref": "#/definitions/GeneralResponse"
},
"authToken": {
"type": "string"
},
"user": {
"$ref": "#/definitions/UserInformation"
}
}
},
"ChangePasswordResponse": {
"properties": {
"responseInfo": {
"$ref": "#/definitions/GeneralResponse"
},
"user": {
"$ref": "#/definitions/UserInformation"
}
}
},
"UserInformation": {
"properties": {
"_id": {
"type": "string"
},
"userName": {
"type": "string"
},
"email": {
"type": "string"
},
"nameFull": {
"type": "string"
},
"lastVisited": {
"type": "string",
"format": "date-time"
},
"createdOn": {
"type": "string",
"format": "date-time"
},
"loginCounts": {
"type": "integer",
"format": "int32"
}
}
},
"DefaultResponse": {
"properties": {
"responseInfo": {
"$ref": "#/definitions/GeneralResponse"
},
"error": {
"type": "string"
}
}
},
"GeneralResponse": {
"properties": {
"success": {
"type": "boolean"
},
"title": {
"type": "string"
},
"message": {
"type": "string"
}
}
}
},
"parameters": {
"LoginBody": {
"name": "LoginBody",
"in": "body",
"description": "Login Params Body",
"schema": {
"required": [
"password"
],
"properties": {
"email": {
"type": "string"
},
"userName": {
"type": "string"
},
"password": {
"type": "string"
}
}
}
},
"NewUserBody": {
"name": "NewUserBody",
"in": "body",
"description": "New User Params Body",
"schema": {
"required": [
"email",
"userName"
],
"properties": {
"email": {
"type": "string"
},
"userName": {
"type": "string"
}
}
}
},
"VerifyUserBody": {
"name": "VerifyUserBody",
"in": "body",
"description": "Verify User Params Body",
"schema": {
"required": [
"email",
"password"
],
"properties": {
"email": {
"type": "string"
},
"password": {
"type": "string"
}
}
}
},
"ChangePasswordBody": {
"name": "ChangePasswordBody",
"in": "body",
"description": "Change Password Params Body",
"schema": {
"required": [
"newPassword"
],
"properties": {
"oldPassword": {
"type": "string"
},
"newPassword": {
"type": "string"
}
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment