Closed sp90 closed 5 years ago
@sp90 Can you provide an example of swagger file that fails without this improvement?
This one 👍
{
"swagger": "2.0",
"info": {
"title": "sometitle",
"version": "0.1.0",
"description": "some description"
},
"paths": {
"/api/blocks/create": {
"POST": {
"tags": ["Blocks"],
"consumes": ["application/json"],
"produces": ["application/json"],
"parameters": [{
"name": "block_title",
"in": "path",
"required": true,
"type": "string",
"description": "Block title. "
}, {
"name": "block_text",
"in": "path",
"required": true,
"type": "string",
"description": "[optional] Block text. "
}],
"responses": {
"200": {
"description": "successful operation",
"schema": {
"type": "JSON",
"items": {
"$ref": "#/definitions/createBlock"
}
}
}
}
}
},
"/api/blocks/delete": {
"DELETE": {
"tags": ["Blocks"],
"consumes": ["application/json"],
"produces": ["application/json"],
"parameters": [{
"name": "block_id",
"in": "path",
"required": true,
"type": "string",
"description": "Block Id to be deleted. "
}],
"responses": {
"200": {
"description": "successful operation",
"schema": {
"type": "JSON",
"items": {
"$ref": "#/definitions/deleteBlock"
}
}
}
}
}
},
"/api/blocks/get/{block_id}": {
"GET": {
"tags": ["Blocks"],
"consumes": ["application/json"],
"produces": ["application/json"],
"parameters": [{
"name": "block_id",
"in": "path",
"required": true,
"type": "string",
"description": "id of the Block to retrieve. "
}],
"responses": {
"200": {
"description": "successful operation",
"schema": {
"type": "JSON",
"items": {
"$ref": "#/definitions/retrieveBlock"
}
}
}
}
}
},
"/api/blocks/search?q=block_title_to_search": {
"GET": {
"tags": ["Blocks"],
"consumes": ["application/json"],
"produces": ["application/json"],
"parameters": [{
"name": "q",
"in": "path",
"required": true,
"type": "string",
"description": "[optional] title of the Block to be searched. "
}],
"responses": {
"200": {
"description": "successful operation",
"schema": {
"type": "JSON",
"items": {
"$ref": "#/definitions/searchBlocks"
}
}
}
}
}
},
"/api/blocks/update": {
"PUT": {
"tags": ["Blocks"],
"consumes": ["application/json"],
"produces": ["application/json"],
"parameters": [{
"name": "block_id",
"in": "path",
"required": true,
"type": "string",
"description": "Block Id to be updated. "
}, {
"name": "block_title",
"in": "path",
"required": true,
"type": "string",
"description": "[optional] Block title. "
}, {
"name": "block_text",
"in": "path",
"required": true,
"type": "string",
"description": "[optional] Block text. "
}],
"responses": {
"200": {
"description": "successful operation",
"schema": {
"type": "JSON",
"items": {
"$ref": "#/definitions/updateBlock"
}
}
}
}
}
},
"/api/dept/create": {
"POST": {
"tags": ["Department"],
"consumes": ["application/json"],
"produces": ["application/json"],
"parameters": [{
"name": "dept_name",
"in": "path",
"required": true,
"type": "string",
"description": "Name of the department to be created.. After the department is created, it cannot be modified. "
}],
"responses": {
"200": {
"description": "successful operation",
"schema": {
"type": "JSON",
"items": {
"$ref": "#/definitions/createDept"
}
}
}
}
}
},
"/api/dept/delete": {
"delete": {
"tags": ["Department"],
"consumes": ["application/json"],
"produces": ["application/json"],
"parameters": [{
"name": "dept_id",
"in": "path",
"required": true,
"type": "string",
"description": "name of the dept to be deleted. "
}],
"responses": {
"200": {
"description": "successful operation",
"schema": {
"type": "JSON",
"items": {
"$ref": "#/definitions/deleteDept"
}
}
}
}
}
},
"/api/dept/all": {
"GET": {
"tags": ["Departments"],
"consumes": ["application/json"],
"produces": ["application/json"],
"parameters": [],
"responses": {
"200": {
"description": "successful operation",
"schema": {
"type": "JSON",
"items": {
"$ref": "#/definitions/retrieveDepts"
}
}
}
}
}
},
"/api/media/create": {
"post": {
"tags": ["Media"],
"consumes": ["application/json"],
"produces": ["application/json"],
"parameters": [{
"name": "file",
"in": "formData",
"required": true,
"type": "file",
"description": "local file required. "
}, {
"in": "body",
"name": "body",
"required": true,
"schema": {
"$ref": "#/definitions/createMedia"
}
}],
"responses": {
"200": {
"description": "successful operation",
"schema": {
"type": "JSON",
"items": {
"$ref": "#/definitions/createMedia"
}
}
}
}
}
},
"/api/media/delete": {
"delete": {
"tags": ["Media"],
"consumes": ["application/json"],
"produces": ["application/json"],
"parameters": [{
"name": "media_id",
"in": "path",
"required": true,
"type": "string",
"description": "id of the media to be deleted. "
}],
"responses": {
"200": {
"description": "successful operation",
"schema": {
"type": "JSON",
"items": {
"$ref": "#/definitions/deleteMedia"
}
}
}
}
}
},
"/api/media/get/{title}": {
"GET": {
"tags": ["Media"],
"consumes": ["application/json"],
"produces": ["application/json"],
"parameters": [{
"name": "title",
"in": "path",
"required": true,
"type": "string",
"description": "Mandatory title by which Media to be retrieved. "
}],
"responses": {
"200": {
"description": "successful operation",
"schema": {
"type": "JSON",
"items": {
"$ref": "#/definitions/getMediaByTitle"
}
}
}
}
}
},
"/api/media/all": {
"GET": {
"tags": ["Media"],
"summary": "This api retrieves a maximum rows as specified in {limit_rows} configuration. For next set of media, send 'last_key' in the api request, whose example value is {"title": "Orientation Class -3","org_id": "1122334455"}. This value can be found in the json response of previous request in the key "LastEvaluatedKey". ",
"consumes": ["application/json"],
"produces": ["application/json"],
"parameters": [{
"name": "org_id",
"in": "path",
"required": true,
"type": "string",
"description": "Mandatory org_id for which Media are to be retrieved. "
}, {
"name": "last_key",
"in": "path",
"required": false,
"type": "string",
"description": "last_key to retrieve next set of Media. "
}],
"responses": {
"200": {
"description": "successful operation",
"schema": {
"type": "JSON",
"items": {
"$ref": "#/definitions/retrieveMedia"
}
}
}
}
}
},
"/api/media/search?q=MediaTitle&file_type='images'&title='video'": {
"get": {
"tags": ["Media"],
"consumes": ["application/json"],
"produces": ["application/json"],
"parameters": [{
"name": "q",
"in": "path",
"required": true,
"type": "string",
"description": "[optional] title the media to be searched. title is case-insensitive. "
}, {
"name": "file_type",
"in": "path",
"required": true,
"type": "string",
"description": "[optional] file_type of the media to be searched. There can be multiple file_type in the query string. "
}],
"responses": {
"200": {
"description": "successful operation",
"schema": {
"type": "JSON",
"items": {
"$ref": "#/definitions/searchMedia"
}
}
}
}
}
},
"/api/media/update": {
"put": {
"tags": ["Media"],
"consumes": ["application/json"],
"produces": ["application/json"],
"parameters": [{
"in": "body",
"name": "body",
"required": true,
"schema": {
"$ref": "#/definitions/updateMedia"
}
}],
"responses": {
"200": {
"description": "successful operation",
"schema": {
"type": "JSON",
"items": {
"$ref": "#/definitions/updateMedia"
}
}
}
}
}
},
"/api/modules/create": {
"POST": {
"tags": ["Modules"],
"consumes": ["application/json"],
"produces": ["application/json"],
"parameters": [{
"name": "module_title",
"in": "path",
"required": true,
"type": "string",
"description": "module title "
}, {
"name": "blocks",
"in": "path",
"required": true,
"type": "json",
"description": "[optional] list of blocks id's The Content-Type of the request has to be "application/json" example values are blocks = [{"media_id":"111","type":"media"},{"type":"block","block_text":"test","block_title":"title"},{"type":"block","block_text":"test new","block_title":"title"}] "
}, {
"name": "questions",
"in": "path",
"required": true,
"type": "json",
"description": "[optional] list of question id's example values are questions = [{"q_text":"what is your name ?","type":"question","all_ans":["a","b"],"correct_ans":["a"],"ans_type":"single"}] "
}],
"responses": {
"200": {
"description": "successful operation",
"schema": {
"type": "JSON",
"items": {
"$ref": "#/definitions/createModule"
}
}
}
}
}
},
"/api/modules/delete": {
"DELETE": {
"tags": ["Modules"],
"consumes": ["application/json"],
"produces": ["application/json"],
"parameters": [{
"name": "module_id",
"in": "path",
"required": true,
"type": "string",
"description": "id module to be deleted. "
}],
"responses": {
"200": {
"description": "successful operation",
"schema": {
"type": "JSON",
"items": {
"$ref": "#/definitions/deleteModule"
}
}
}
}
}
},
"/api/modules/all": {
"GET": {
"tags": ["Modules"],
"consumes": ["application/json"],
"produces": ["application/json"],
"parameters": [{
"name": "last_key",
"in": "path",
"required": true,
"type": "string",
"description": "[optional] Last key in case of pagination. "
}],
"responses": {
"200": {
"description": "successful operation",
"schema": {
"type": "JSON",
"items": {
"$ref": "#/definitions/retrieveAllModules"
}
}
}
}
}
},
"/api/modules/search?q=module_title": {
"GET": {
"tags": ["Modules"],
"consumes": ["application/json"],
"produces": ["application/json"],
"parameters": [{
"name": "q",
"in": "path",
"required": true,
"type": "string",
"description": "[optional] Title of the module to be searched. all modules that contains the module_title ( case insensitive) are returned. "
}],
"responses": {
"200": {
"description": "successful operation",
"schema": {
"type": "JSON",
"items": {
"$ref": "#/definitions/searchModules"
}
}
}
}
}
},
"/api/modules/update": {
"PUT": {
"tags": ["Modules"],
"consumes": ["application/json"],
"produces": ["application/json"],
"parameters": [{
"name": "module_id",
"in": "path",
"required": true,
"type": "string",
"description": "id of the module to be updated. "
}, {
"name": "module_title",
"in": "path",
"required": true,
"type": "string",
"description": "[optional] module title. "
}, {
"name": "blocks",
"in": "path",
"required": true,
"type": "string",
"description": "[optional] Blocks Array to be assigned to this module. example values are blocks =[{"block_id":"90b4531dbbd943dc","type":"block","block_text":"This one is updated one while module update","block_title":"module update"}] block_id is mandatory here "
}, {
"name": "questions",
"in": "path",
"required": true,
"type": "string",
"description": "[optional] Questions Array to be assigned to this module. example values are questions =[{"q_id":"5555","q_text":"ok?","type":"question","all_ans":["yes","no"],"correct_ans":["yes"]}] q_id is mandatory here "
}],
"responses": {
"200": {
"description": "successful operation",
"schema": {
"type": "JSON",
"items": {
"$ref": "#/definitions/updateModules"
}
}
}
}
}
},
"/api/org/create": {
"POST": {
"tags": ["Organization"],
"consumes": ["application/json"],
"produces": ["application/json"],
"parameters": [{
"name": "orgname",
"in": "path",
"required": true,
"type": "string",
"description": "Mandatory Name of the organization to be created.. "
}, {
"name": "departments",
"in": "path",
"required": true,
"type": "array",
"description": "Optional departments name for the organization to be created.. example values are "department":["Finance","HR"] "
}],
"responses": {
"200": {
"description": "successful operation",
"schema": {
"type": "JSON",
"items": {
"$ref": "#/definitions/createOrg"
}
}
}
}
}
},
"/api/org/delete": {
"delete": {
"tags": ["Organization"],
"consumes": ["application/json"],
"produces": ["application/json"],
"parameters": [{
"name": "org_id",
"in": "path",
"required": true,
"type": "string",
"description": "Id of the org to be deleted. "
}],
"responses": {
"200": {
"description": "successful operation",
"schema": {
"type": "JSON",
"items": {
"$ref": "#/definitions/deleteOrg"
}
}
}
}
}
},
"/api/org/search?orgname=orgname": {
"GET": {
"tags": ["Organization"],
"consumes": ["application/json"],
"produces": ["application/json"],
"parameters": [{
"name": "orgname",
"in": "path",
"required": true,
"type": "string",
"description": "[optional] Name of the organizations to be searched. All orgs whose name contains 'orgname' are retrieved. "
}],
"responses": {
"200": {
"description": "successful operation",
"schema": {
"type": "JSON",
"items": {
"$ref": "#/definitions/searchOrg"
}
}
}
}
}
},
"/api/org/update": {
"put": {
"tags": ["Organization"],
"consumes": ["application/json"],
"produces": ["application/json"],
"parameters": [{
"in": "body",
"name": "body",
"required": true,
"schema": {
"$ref": "#/definitions/updateOrg"
}
}],
"responses": {
"200": {
"description": "successful operation",
"schema": {
"type": "JSON",
"items": {
"$ref": "#/definitions/updateOrg"
}
}
}
}
}
},
"/api/questions/create": {
"POST": {
"tags": ["Question"],
"consumes": ["application/json"],
"produces": ["application/json"],
"parameters": [{
"name": "q_text",
"in": "path",
"required": true,
"type": "string",
"description": "Mandatory Question defination "
}, {
"name": "ans_type",
"in": "path",
"required": true,
"type": "string",
"description": "Mandatory type of the answer. all_ans "
}, {
"name": "all_ans",
"in": "path",
"required": true,
"type": "json",
"description": "Mandatory(Array) List of all available ans "
}],
"responses": {
"200": {
"description": "successful operation",
"schema": {
"type": "JSON",
"items": {
"$ref": "#/definitions/createQuestion"
}
}
}
}
}
},
"/api/question/delete": {
"delete": {
"tags": ["Question"],
"consumes": ["application/json"],
"produces": ["application/json"],
"parameters": [{
"name": "q_id",
"in": "path",
"required": true,
"type": "string",
"description": "id of the question to be deleted. "
}],
"responses": {
"200": {
"description": "successful operation",
"schema": {
"type": "JSON",
"items": {
"$ref": "#/definitions/deleteQuestion"
}
}
}
}
}
},
"/api/questions/all": {
"GET": {
"tags": ["Question"],
"summary": "This api retrieves a maximum rows as specified in {limit_rows} configuration. For next set of Types, send 'last_key' in the api request, whose example value is {"q_id": "modules","org_id": "9377a535a1c198a5"}. This value can be found in the json response of previous request in the key "LastEvaluatedKey". ",
"consumes": ["application/json"],
"produces": ["application/json"],
"parameters": [{
"name": "last_key",
"in": "path",
"required": false,
"type": "string",
"description": "last_key to retrieve next set of Types. "
}],
"responses": {
"200": {
"description": "successful operation",
"schema": {
"type": "JSON",
"items": {
"$ref": "#/definitions/retrieveAllQuestions"
}
}
}
}
}
},
"/api/questions/get/{q_id}": {
"GET": {
"tags": ["Question"],
"consumes": ["application/json"],
"produces": ["application/json"],
"parameters": [{
"name": "q_id",
"in": "path",
"required": true,
"type": "string",
"description": "Mandatory id of the question. "
}],
"responses": {
"200": {
"description": "successful operation",
"schema": {
"type": "JSON",
"items": {
"$ref": "#/definitions/retrieveQuestion"
}
}
}
}
}
},
"/api/questions/search?q=question_text": {
"GET": {
"tags": ["Questions"],
"consumes": ["application/json"],
"produces": ["application/json"],
"parameters": [{
"name": "q",
"in": "path",
"required": true,
"type": "string",
"description": "[optional] text of the question to be searched. "
}],
"responses": {
"200": {
"description": "successful operation",
"schema": {
"type": "JSON",
"items": {
"$ref": "#/definitions/searchQuestions"
}
}
}
}
}
},
"/api/questions/update": {
"put": {
"tags": ["Question"],
"consumes": ["application/json"],
"produces": ["application/json"],
"parameters": [{
"in": "body",
"name": "body",
"required": true,
"schema": {
"$ref": "#/definitions/updateQuestion"
}
}],
"responses": {
"200": {
"description": "successful operation",
"schema": {
"type": "JSON",
"items": {
"$ref": "#/definitions/updateQuestion"
}
}
}
}
}
},
"/security/user/authenticate/refresh-token": {
"get": {
"tags": ["Security"],
"summary": "pass either token or x-access-token ",
"consumes": ["application/json"],
"produces": ["application/json"],
"parameters": [{
"name": "token",
"in": "path",
"required": true,
"type": "string",
"description": "old token. "
}],
"responses": {
"200": {
"description": "successful operation",
"schema": {
"type": "JSON",
"items": {
"$ref": "#/definitions/RefreshToken"
}
}
}
}
}
},
"/security/user/authenticate": {
"post": {
"tags": ["Security"],
"consumes": ["application/json"],
"produces": ["application/json"],
"parameters": [{
"in": "body",
"name": "body",
"required": true,
"schema": {
"$ref": "#/definitions/authenticate"
}
}],
"responses": {
"200": {
"description": "successful operation",
"schema": {
"type": "JSON",
"items": {
"$ref": "#/definitions/authenticate"
}
}
}
}
}
},
"/security/user/create": {
"post": {
"tags": ["Security"],
"consumes": ["application/json"],
"produces": ["application/json"],
"parameters": [{
"in": "body",
"name": "body",
"required": true,
"schema": {
"$ref": "#/definitions/createuser"
}
}],
"responses": {
"200": {
"description": "successful operation",
"schema": {
"type": "JSON",
"items": {
"$ref": "#/definitions/createuser"
}
}
}
}
}
},
"/security/user/forgotpwd": {
"post": {
"tags": ["Security"],
"consumes": ["application/json"],
"produces": ["application/json"],
"parameters": [{
"in": "body",
"name": "body",
"required": true,
"schema": {
"$ref": "#/definitions/forgotPasswordEmail"
}
}],
"responses": {
"200": {
"description": "successful operation",
"schema": {
"type": "JSON",
"items": {
"$ref": "#/definitions/forgotPasswordEmail"
}
}
}
}
}
},
"/security/user/resend": {
"post": {
"tags": ["Security"],
"consumes": ["application/json"],
"produces": ["application/json"],
"parameters": [{
"in": "body",
"name": "body",
"required": true,
"schema": {
"$ref": "#/definitions/resendInvite"
}
}],
"responses": {
"200": {
"description": "successful operation",
"schema": {
"type": "JSON",
"items": {
"$ref": "#/definitions/resendInvite"
}
}
}
}
}
},
"/api/timelines/create": {
"POST": {
"tags": ["Timelines"],
"consumes": ["application/json"],
"produces": ["application/json"],
"parameters": [{
"name": "tlname",
"in": "path",
"required": true,
"type": "string",
"description": "Mandatory Name of the Timeline to be created. "
}, {
"name": "org_id",
"in": "path",
"required": true,
"type": "string",
"description": "Mandatory org_id of the Org with which this Timeline to created. "
}, {
"name": "allowedVal",
"in": "path",
"required": true,
"type": "string",
"description": "Mandatory valid values this Timeline. "
}, {
"name": "target",
"in": "path",
"required": true,
"type": "string",
"description": "[optional] target such as URL or other destination. "
}, {
"name": "description",
"in": "path",
"required": true,
"type": "string",
"description": "[optional] description of this timeline. "
}],
"responses": {
"200": {
"description": "successful operation",
"schema": {
"type": "JSON",
"items": {
"$ref": "#/definitions/createTimeline"
}
}
}
}
}
},
"/api/timelines/delete": {
"delete": {
"tags": ["Timelines"],
"consumes": ["application/json"],
"produces": ["application/json"],
"parameters": [{
"name": "tl_name",
"in": "path",
"required": true,
"type": "string",
"description": "name of the timeline to be deleted. "
}],
"responses": {
"200": {
"description": "successful operation",
"schema": {
"type": "JSON",
"items": {
"$ref": "#/definitions/deleteTimeline"
}
}
}
}
}
},
"/api/timelines/get/{tl_name}": {
"GET": {
"tags": ["Timelines"],
"summary": "This api will return a particular timeline ",
"consumes": ["application/json"],
"produces": ["application/json"],
"parameters": [{
"name": "tl_name",
"in": "path",
"required": true,
"type": "string",
"description": "Mandatory title by which Type to be retrieved. "
}],
"responses": {
"200": {
"description": "successful operation",
"schema": {
"type": "JSON",
"items": {
"$ref": "#/definitions/getTimeLineByName"
}
}
}
}
}
},
"/api/timelines/all": {
"GET": {
"tags": ["Timelines"],
"summary": "This api retrieves a maximum rows as specified in {limit_rows} configuration. For next set of timelines, send 'last_key' in the api request, whose example value is {"tl_name":"Security Policies - part 8","org_id": "9377a535a1c198a5"}. This value can be found in the json response of previous request in the key "LastEvaluatedKey". ",
"consumes": ["application/json"],
"produces": ["application/json"],
"parameters": [{
"name": "org_id",
"in": "path",
"required": true,
"type": "string",
"description": "Mandatory org_id for which Timeline are to be retrieved. "
}, {
"name": "last_key",
"in": "path",
"required": false,
"type": "string",
"description": "last_key to retrieve next set of timelines. "
}],
"responses": {
"200": {
"description": "successful operation",
"schema": {
"type": "JSON",
"items": {
"$ref": "#/definitions/retrieveTimelines"
}
}
}
}
}
},
"/api/timelines/update": {
"put": {
"tags": ["Timelines"],
"consumes": ["application/json"],
"produces": ["application/json"],
"parameters": [{
"in": "body",
"name": "body",
"required": true,
"schema": {
"$ref": "#/definitions/updateTimeline"
}
}],
"responses": {
"200": {
"description": "successful operation",
"schema": {
"type": "JSON",
"items": {
"$ref": "#/definitions/updateTimeline"
}
}
}
}
}
},
"/api/types/create": {
"POST": {
"tags": ["Types"],
"consumes": ["application/json"],
"produces": ["application/json"],
"parameters": [{
"name": "typename",
"in": "path",
"required": true,
"type": "string",
"description": "Mandatory Name of the Type to be created. "
}, {
"name": "allowedVal",
"in": "path",
"required": true,
"type": "string",
"description": "Mandatory valid values this types accepts. "
}],
"responses": {
"200": {
"description": "successful operation",
"schema": {
"type": "JSON",
"items": {
"$ref": "#/definitions/createType"
}
}
}
}
}
},
"/api/types/delete": {
"delete": {
"tags": ["Types"],
"consumes": ["application/json"],
"produces": ["application/json"],
"parameters": [{
"name": "type_name",
"in": "path",
"required": true,
"type": "string",
"description": "name of the type to be deleted. "
}],
"responses": {
"200": {
"description": "successful operation",
"schema": {
"type": "JSON",
"items": {
"$ref": "#/definitions/deleteType"
}
}
}
}
}
},
"/api/types/get/{type_name}": {
"GET": {
"tags": ["Types"],
"summary": "This api will return a particular type ",
"consumes": ["application/json"],
"produces": ["application/json"],
"parameters": [{
"name": "type_name",
"in": "path",
"required": true,
"type": "string",
"description": "Mandatory title by which Type to be retrieved. "
}],
"responses": {
"200": {
"description": "successful operation",
"schema": {
"type": "JSON",
"items": {
"$ref": "#/definitions/getTypeByName"
}
}
}
}
}
},
"/api/types/all": {
"GET": {
"tags": ["Types"],
"summary": "This api retrieves a maximum rows as specified in {limit_rows} configuration. For next set of Types, send 'last_key' in the api request, whose example value is {"typename": "modules","org_id": "9377a535a1c198a5"}. This value can be found in the json response of previous request in the key "LastEvaluatedKey". ",
"consumes": ["application/json"],
"produces": ["application/json"],
"parameters": [{
"name": "last_key",
"in": "path",
"required": false,
"type": "string",
"description": "last_key to retrieve next set of Types. "
}],
"responses": {
"200": {
"description": "successful operation",
"schema": {
"type": "JSON",
"items": {
"$ref": "#/definitions/retrieveTypes"
}
}
}
}
}
},
"/api/type/update": {
"put": {
"tags": ["Types"],
"consumes": ["application/json"],
"produces": ["application/json"],
"parameters": [{
"in": "body",
"name": "body",
"required": true,
"schema": {
"$ref": "#/definitions/updateType"
}
}],
"responses": {
"200": {
"description": "successful operation",
"schema": {
"type": "JSON",
"items": {
"$ref": "#/definitions/updateType"
}
}
}
}
}
},
"/api/user/activate": {
"post": {
"tags": ["User"],
"consumes": ["application/json"],
"produces": ["application/json"],
"parameters": [{
"in": "body",
"name": "body",
"required": true,
"schema": {
"$ref": "#/definitions/activateUser"
}
}],
"responses": {
"200": {
"description": "successful operation",
"schema": {
"type": "JSON",
"items": {
"$ref": "#/definitions/activateUser"
}
}
}
}
}
},
"/api/user/delete": {
"delete": {
"tags": ["User"],
"consumes": ["application/json"],
"produces": ["application/json"],
"parameters": [{
"name": "email",
"in": "path",
"required": true,
"type": "string",
"description": "email of the user to be Deleted. "
}],
"responses": {
"200": {
"description": "successful operation",
"schema": {
"type": "JSON",
"items": {
"$ref": "#/definitions/deleteUser"
}
}
}
}
}
},
"/api/user/get/{email}": {
"get": {
"tags": ["User"],
"consumes": ["application/json"],
"produces": ["application/json"],
"parameters": [{
"name": "email",
"in": "path",
"required": true,
"type": "string",
"description": "Mandatory email of the user to be retrieved. "
}],
"responses": {
"200": {
"description": "successful operation",
"schema": {
"type": "JSON",
"items": {
"$ref": "#/definitions/getUser"
}
}
}
}
}
},
"/api/user/invite": {
"post": {
"tags": ["User"],
"consumes": ["application/json"],
"produces": ["application/json"],
"parameters": [{
"in": "body",
"name": "body",
"required": true,
"schema": {
"$ref": "#/definitions/invite_emails"
}
}],
"responses": {
"200": {
"description": "successful operation",
"schema": {
"type": "String",
"items": {
"$ref": "#/definitions/inviteUsers"
}
}
}
}
}
},
"/api/user/reset-password": {
"post": {
"tags": ["User"],
"consumes": ["application/json"],
"produces": ["application/json"],
"parameters": [{
"in": "body",
"name": "body",
"required": true,
"schema": {
"$ref": "#/definitions/resetPassword"
}
}],
"responses": {
"200": {
"description": "successful operation",
"schema": {
"type": "JSON",
"items": {
"$ref": "#/definitions/resetPassword"
}
}
}
}
}
},
"/api/user/search?email=venkatrv75@gma&user_name=Ram&dept=Finance": {
"get": {
"tags": ["User"],
"consumes": ["application/json"],
"produces": ["application/json"],
"parameters": [{
"name": "email",
"in": "path",
"required": true,
"type": "string",
"description": "[optional] email of the user(s) to be searched. "
}, {
"name": "user_name",
"in": "path",
"required": true,
"type": "string",
"description": "[optional] user_name of the user(s) to be searched. "
}, {
"name": "dept",
"in": "path",
"required": true,
"type": "string",
"description": "[optional] department to be searched. Input could be first few charecters of the email and/or user name and/or department. "
}],
"responses": {
"200": {
"description": "successful operation",
"schema": {
"type": "JSON",
"items": {
"$ref": "#/definitions/searchUser"
}
}
}
}
}
},
"/api/user/update": {
"post": {
"tags": ["User"],
"consumes": ["application/json"],
"produces": ["application/json"],
"parameters": [{
"in": "body",
"name": "body",
"required": true,
"schema": {
"$ref": "#/definitions/updateUser"
}
}],
"responses": {
"200": {
"description": "successful operation",
"schema": {
"type": "JSON",
"items": {
"$ref": "#/definitions/updateUser"
}
}
}
}
}
}
},
"definitions": {
"createBlock": {
"properties": {
"block_title": {
"type": "string",
"description": "Block title. "
},
"block_text": {
"type": "string",
"description": "[optional] Block text. "
},
"JSON": {
"type": "json",
"description": "If Block is created. "
}
},
"required": ["block_title", "block_text", "JSON"]
},
"deleteBlock": {
"properties": {
"block_id": {
"type": "string",
"description": "Block Id to be deleted. "
},
"JSON": {
"type": "json",
"description": "If Block is deleted. "
}
},
"required": ["block_id", "JSON"]
},
"retrieveBlock": {
"properties": {
"block_id": {
"type": "string",
"description": "id of the Block to retrieve. "
},
"JSON": {
"type": "json",
"description": "If Block existed and retrieved. "
}
},
"required": ["block_id", "JSON"]
},
"searchBlocks": {
"properties": {
"q": {
"type": "string",
"description": "[optional] title of the Block to be searched. "
},
"JSON": {
"type": "json",
"description": "If Block is retrieved. "
}
},
"required": ["q", "JSON"]
},
"updateBlock": {
"properties": {
"block_id": {
"type": "string",
"description": "Block Id to be updated. "
},
"block_title": {
"type": "string",
"description": "[optional] Block title. "
},
"block_text": {
"type": "string",
"description": "[optional] Block text. "
},
"JSON": {
"type": "json",
"description": "If Block is updated. "
}
},
"required": ["block_id", "block_title", "block_text", "JSON"]
},
"createDept": {
"properties": {
"dept_name": {
"type": "string",
"description": "Name of the department to be created.. After the department is created, it cannot be modified. "
},
"JSON": {
"type": "json",
"description": "If Dept is created. "
}
},
"required": ["dept_name", "JSON"]
},
"deleteDept": {
"properties": {
"dept_id": {
"type": "string",
"description": "name of the dept to be deleted. "
},
"JSON": {
"type": "json",
"description": "If the dept is deleted. "
}
},
"required": ["dept_id", "JSON"]
},
"retrieveDepts": {
"properties": {
"JSON": {
"type": "json",
"description": "All departments. "
}
},
"required": ["JSON"]
},
"createMedia": {
"properties": {
"title": {
"type": "string",
"description": "[optional] Title of the media. Name of the file is used if not passed. "
},
"file": {
"type": "file",
"description": "local file required. "
},
"json": {
"type": "json",
"description": "if operation is successful. "
}
},
"required": ["title", "file", "json"]
},
"deleteMedia": {
"properties": {
"media_id": {
"type": "string",
"description": "id of the media to be deleted. "
},
"JSON": {
"type": "json",
"description": "If the media is deleted. "
}
},
"required": ["media_id", "JSON"]
},
"getMediaByTitle": {
"properties": {
"title": {
"type": "string",
"description": "Mandatory title by which Media to be retrieved. "
},
"JSON": {
"type": "json",
"description": "If Media is retrieved. "
}
},
"required": ["title", "JSON"]
},
"retrieveMedia": {
"properties": {
"org_id": {
"type": "string",
"description": "Mandatory org_id for which Media are to be retrieved. "
},
"last_key": {
"type": "string",
"description": "last_key to retrieve next set of Media. "
},
"JSON": {
"type": "json",
"description": "If Media is retrieved. "
}
},
"required": ["org_id", "JSON"]
},
"searchMedia": {
"properties": {
"q": {
"type": "string",
"description": "[optional] title the media to be searched. title is case-insensitive. "
},
"file_type": {
"type": "string",
"description": "[optional] file_type of the media to be searched. There can be multiple file_type in the query string. "
},
"JSON": {
"type": "json",
"description": "If the media is available. "
}
},
"required": ["q", "file_type", "JSON"]
},
"updateMedia": {
"properties": {
"media_id": {
"type": "string",
"description": "media_id to be updated. "
},
"title": {
"type": "string",
"description": "[optional] Title of the media. "
},
"tags": {
"type": "array",
"description": "[optional] array of string tags to be updated. "
},
"json": {
"type": "json",
"description": "if operation is successful. "
}
},
"required": ["media_id", "title", "tags", "json"]
},
"createModule": {
"properties": {
"module_title": {
"type": "string",
"description": "module title "
},
"blocks": {
"type": "json",
"description": "[optional] list of blocks id's The Content-Type of the request has to be "application/json" example values are blocks = [{"media_id":"111","type":"media"},{"type":"block","block_text":"test","block_title":"title"},{"type":"block","block_text":"test new","block_title":"title"}] "
},
"questions": {
"type": "json",
"description": "[optional] list of question id's example values are questions = [{"q_text":"what is your name ?","type":"question","all_ans":["a","b"],"correct_ans":["a"],"ans_type":"single"}] "
},
"JSON": {
"type": "json",
"description": "If Module is created. "
}
},
"required": ["module_title", "blocks", "questions", "JSON"]
},
"deleteModule": {
"properties": {
"module_id": {
"type": "string",
"description": "id module to be deleted. "
},
"JSON": {
"type": "json",
"description": "If Module is deleted. "
}
},
"required": ["module_id", "JSON"]
},
"retrieveAllModules": {
"properties": {
"last_key": {
"type": "string",
"description": "[optional] Last key in case of pagination. "
},
"JSON": {
"type": "json",
"description": "If Modules are retrieved. "
}
},
"required": ["last_key", "JSON"]
},
"searchModules": {
"properties": {
"q": {
"type": "string",
"description": "[optional] Title of the module to be searched. all modules that contains the module_title ( case insensitive) are returned. "
},
"JSON": {
"type": "json",
"description": "If Module is retrieved. "
}
},
"required": ["q", "JSON"]
},
"updateModules": {
"properties": {
"module_id": {
"type": "string",
"description": "id of the module to be updated. "
},
"module_title": {
"type": "string",
"description": "[optional] module title. "
},
"blocks": {
"type": "string",
"description": "[optional] Blocks Array to be assigned to this module. example values are blocks =[{"block_id":"90b4531dbbd943dc","type":"block","block_text":"This one is updated one while module update","block_title":"module update"}] block_id is mandatory here "
},
"questions": {
"type": "string",
"description": "[optional] Questions Array to be assigned to this module. example values are questions =[{"q_id":"5555","q_text":"ok?","type":"question","all_ans":["yes","no"],"correct_ans":["yes"]}] q_id is mandatory here "
},
"JSON": {
"type": "json",
"description": "If Modules are retrieved. "
}
},
"required": ["module_id", "module_title", "blocks", "questions", "JSON"]
},
"createOrg": {
"properties": {
"orgname": {
"type": "string",
"description": "Mandatory Name of the organization to be created.. "
},
"departments": {
"type": "array",
"description": "Optional departments name for the organization to be created.. example values are "department":["Finance","HR"] "
},
"JSON": {
"type": "json",
"description": "If org is created. "
}
},
"required": ["orgname", "departments", "JSON"]
},
"deleteOrg": {
"properties": {
"org_id": {
"type": "string",
"description": "Id of the org to be deleted. "
},
"JSON": {
"type": "json",
"description": "If the org is deleted. "
}
},
"required": ["org_id", "JSON"]
},
"searchOrg": {
"properties": {
"orgname": {
"type": "string",
"description": "[optional] Name of the organizations to be searched. All orgs whose name contains 'orgname' are retrieved. "
},
"JSON": {
"type": "json",
"description": "Matching Orgs. "
}
},
"required": ["orgname", "JSON"]
},
"updateOrg": {
"properties": {
"org_id": {
"type": "string",
"description": "Id of the org to be updated. "
},
"department": {
"type": "array",
"description": "of this org to be updated. department=["1","2"] "
},
"JSON": {
"type": "json",
"description": "If org updated successfully. "
}
},
"required": ["org_id", "department", "JSON"]
},
"createQuestion": {
"properties": {
"q_text": {
"type": "string",
"description": "Mandatory Question defination "
},
"ans_type": {
"type": "string",
"description": "Mandatory type of the answer. all_ans "
},
"all_ans": {
"type": "json",
"description": "Mandatory(Array) List of all available ans "
},
"JSON": {
"type": "json",
"description": "If Question is created. "
}
},
"required": ["q_text", "ans_type", "all_ans", "JSON"]
},
"deleteQuestion": {
"properties": {
"q_id": {
"type": "string",
"description": "id of the question to be deleted. "
},
"JSON": {
"type": "json",
"description": "If the question is deleted. "
}
},
"required": ["q_id", "JSON"]
},
"retrieveAllQuestions": {
"properties": {
"last_key": {
"type": "string",
"description": "last_key to retrieve next set of Types. "
},
"JSON": {
"type": "json",
"description": "If Questions is retrieved. "
}
},
"required": ["JSON"]
},
"retrieveQuestion": {
"properties": {
"q_id": {
"type": "string",
"description": "Mandatory id of the question. "
},
"JSON": {
"type": "json",
"description": "If question existed and retrieved. "
}
},
"required": ["q_id", "JSON"]
},
"searchQuestions": {
"properties": {
"q": {
"type": "string",
"description": "[optional] text of the question to be searched. "
},
"JSON": {
"type": "json",
"description": "If Question is retrieved. "
}
},
"required": ["q", "JSON"]
},
"updateQuestion": {
"properties": {
"q_id": {
"type": "string",
"description": "id of the question. "
},
"q_rext": {
"type": "string",
"description": "question defination. "
},
"ans_type": {
"type": "string",
"description": "type of the answer. "
},
"all_ans": {
"type": "json",
"description": "(Array) list of all available answers "
},
"correct_ans": {
"type": "string",
"description": "correct ans of the question. "
},
"JSON": {
"type": "json",
"description": "If org updated successfully. "
}
},
"required": ["q_id", "q_rext", "ans_type", "all_ans", "correct_ans", "JSON"]
},
"RefreshToken": {
"properties": {
"token": {
"type": "string",
"description": "old token. "
},
"JSON": {
"type": "json",
"description": "with 'token' e.g, {success: true, message: 'Authentication successful.', token:'ABCD123456789efghijk'} "
}
},
"required": ["token", "JSON"]
},
"authenticate": {
"properties": {
"email": {
"type": "string",
"description": "Mandatory email of the user. "
},
"password": {
"type": "string",
"description": "Mandatory password. "
},
"JSON": {
"type": "json",
"description": "with 'token' e.g, {success: true, message: 'Authentication successful.', token:'ABCD123456789efghijk'} "
}
},
"required": ["email", "password", "JSON"]
},
"createuser": {
"properties": {
"email": {
"type": "string",
"description": "Mandatory email of the user to be created. "
},
"password": {
"type": "string",
"description": "Mandatory password. "
},
"JSON": {
"type": "json",
"description": "If user exists. "
}
},
"required": ["email", "password", "JSON"]
},
"forgotPasswordEmail": {
"properties": {
"email": {
"type": "string",
"description": "email to whom forgot password link is to be sent. "
},
"JSON": {
"type": "json",
"description": "If the user exists and email is sent. "
}
},
"required": ["email", "JSON"]
},
"resendInvite": {
"properties": {
"email": {
"type": "string",
"description": "email of the user to resend invitation. "
},
"JSON": {
"type": "json",
"description": "If resend is successful. "
}
},
"required": ["email", "JSON"]
},
"createTimeline": {
"properties": {
"tlname": {
"type": "string",
"description": "Mandatory Name of the Timeline to be created. "
},
"org_id": {
"type": "string",
"description": "Mandatory org_id of the Org with which this Timeline to created. "
},
"allowedVal": {
"type": "string",
"description": "Mandatory valid values this Timeline. "
},
"target": {
"type": "string",
"description": "[optional] target such as URL or other destination. "
},
"description": {
"type": "string",
"description": "[optional] description of this timeline. "
},
"JSON": {
"type": "json",
"description": "If Timeline is created. "
}
},
"required": ["tlname", "org_id", "allowedVal", "target", "description", "JSON"]
},
"deleteTimeline": {
"properties": {
"tl_name": {
"type": "string",
"description": "name of the timeline to be deleted. "
},
"JSON": {
"type": "json",
"description": "If the timeline is deleted. "
}
},
"required": ["tl_name", "JSON"]
},
"getTimeLineByName": {
"properties": {
"tl_name": {
"type": "string",
"description": "Mandatory title by which Type to be retrieved. "
},
"JSON": {
"type": "json",
"description": "If Media is retrieved. "
}
},
"required": ["tl_name", "JSON"]
},
"retrieveTimelines": {
"properties": {
"org_id": {
"type": "string",
"description": "Mandatory org_id for which Timeline are to be retrieved. "
},
"last_key": {
"type": "string",
"description": "last_key to retrieve next set of timelines. "
},
"JSON": {
"type": "json",
"description": "If Timelines is retrieved. "
}
},
"required": ["org_id", "JSON"]
},
"updateTimeline": {
"properties": {
"tl_name": {
"type": "string",
"description": "Mandatory name of the timeline to be updated. "
},
"allowed_values": {
"type": "string",
"description": "allowed_values of the timeline to be updated. "
},
"target": {
"type": "string",
"description": "target of the timeline to be updated. "
},
"desc": {
"type": "string",
"description": "desc of the timeline to be updated. "
},
"JSON": {
"type": "json",
"description": "If the timeline is deleted. "
}
},
"required": ["tl_name", "allowed_values", "target", "desc", "JSON"]
},
"createType": {
"properties": {
"typename": {
"type": "string",
"description": "Mandatory Name of the Type to be created. "
},
"allowedVal": {
"type": "string",
"description": "Mandatory valid values this types accepts. "
},
"JSON": {
"type": "json",
"description": "If Type is created. "
}
},
"required": ["typename", "allowedVal", "JSON"]
},
"deleteType": {
"properties": {
"type_name": {
"type": "string",
"description": "name of the type to be deleted. "
},
"JSON": {
"type": "json",
"description": "If the type is deleted. "
}
},
"required": ["type_name", "JSON"]
},
"getTypeByName": {
"properties": {
"type_name": {
"type": "string",
"description": "Mandatory title by which Type to be retrieved. "
},
"JSON": {
"type": "json",
"description": "If Media is retrieved. "
}
},
"required": ["type_name", "JSON"]
},
"retrieveTypes": {
"properties": {
"last_key": {
"type": "string",
"description": "last_key to retrieve next set of Types. "
},
"JSON": {
"type": "json",
"description": "If Type is retrieved. "
}
},
"required": ["JSON"]
},
"updateType": {
"properties": {
"typename": {
"type": "string",
"description": "Mandatory name of the type to be updated. "
},
"allowed_values": {
"type": "string",
"description": "allowed_values of the timeline to be updated. "
},
"JSON": {
"type": "json",
"description": "If the timeline is deleted. "
}
},
"required": ["typename", "allowed_values", "JSON"]
},
"activateUser": {
"properties": {
"token": {
"type": "string",
"description": "signed token created for the purpose of activating user. "
},
"JSON": {
"type": "json",
"description": "If user Activation is successful. "
}
},
"required": ["token", "JSON"]
},
"deleteUser": {
"properties": {
"email": {
"type": "string",
"description": "email of the user to be Deleted. "
},
"JSON": {
"type": "json",
"description": "If the user is deleted. "
}
},
"required": ["email", "JSON"]
},
"getUser": {
"properties": {
"email": {
"type": "string",
"description": "Mandatory email of the user to be retrieved. "
},
"JSON": {
"type": "json",
"description": "If email exists. "
}
},
"required": ["email", "JSON"]
},
"invite_emails": {
"properties": {},
"required": []
},
"inviteUsers": {
"properties": {
"org_id": {
"type": "string",
"description": "Org id to which invited users eventually belong. "
},
"sender_email": {
"type": "string",
"description": "Email id of the inviter. "
},
"id": {
"type": "string",
"description": "of this invite request. "
}
},
"required": ["org_id", "sender_email", "id"]
},
"resetPassword": {
"properties": {
"token": {
"type": "string",
"description": "Token sent in the email. "
},
"password": {
"type": "string",
"description": "New password. "
},
"JSON": {
"type": "json",
"description": "If the user password changed successfully. "
}
},
"required": ["token", "password", "JSON"]
},
"searchUser": {
"properties": {
"email": {
"type": "string",
"description": "[optional] email of the user(s) to be searched. "
},
"user_name": {
"type": "string",
"description": "[optional] user_name of the user(s) to be searched. "
},
"dept": {
"type": "string",
"description": "[optional] department to be searched. Input could be first few charecters of the email and/or user name and/or department. "
},
"JSON": {
"type": "json",
"description": "If users exists and retrieved. "
}
},
"required": ["email", "user_name", "dept", "JSON"]
},
"updateUser": {
"properties": {
"email": {
"type": "string",
"description": "email of the user to be updated. "
},
"is_org_admin": {
"type": "string",
"description": "[optional] T/F is this user is org admin. "
},
"permissions": {
"type": "json",
"description": "[optional] Permissions to be assigned to this user. "
},
"timelines": {
"type": "json",
"description": "[optional] timelines to be assigned to this user. "
},
"user_name": {
"type": "string",
"description": "[optional] name of the user. "
},
"job_title": {
"type": "string",
"description": "[optional] job title of the user. "
},
"lang": {
"type": "string",
"description": "[optional] language of the user. "
},
"phone_number": {
"type": "string",
"description": "[optional] phone number of the user. "
},
"department": {
"type": "string",
"description": "[optional] name of the department to be assigned to this user. "
},
"JSON": {
"type": "json",
"description": "If user updated successfully. "
}
},
"required": ["email", "is_org_admin", "permissions", "timelines", "user_name", "job_title", "lang", "phone_number", "department", "JSON"]
}
}
}
Besides this, its a more bulletproof way of writing code in general 💯
@sp90 Thanks for sending this file. Can you send me a valid swagger file that fails? In the meantime I will add the sway validation to the codegen
@wcandillon what makes it invalid :)
@sp90 Can you check with the validator at http://editor.swagger.io ?
@wcandillon i used this tool: https://github.com/fsbahman/apidoc-swagger
Before selecting type