I m also facing the same issue. I have pasted my yaml code. Please look into it.
swagger: "2.0"
info:
version: "0.0.1"
title: User Operations
# during dev, should point to your local machine
host: localhost:10010
# basePath prefixes all resource paths
basePath: /
#
schemes:
# tip: remove http to make production-grade
- http
- https
# format of bodies a client can send (Content-Type)
consumes:
- application/json
# format of the responses to the client (Accepts)
produces:
- application/json
paths:
/user/source:
# binds a127 app logic to a route
x-swagger-router-controller: source
get:
description: Returns list of Users
# used as the method name of the controller
operationId: getAll
responses:
"200":
description: Success
schema:
$ref: "#/definitions/User"
# responses may fall through to errors
default:
description: Error
schema:
$ref: "#/definitions/ErrorResponse"
put:
summary: to edit Users details
description: edit all the users to database
operationId: save
parameters:
- name: edit user details
in: body
required: true
schema:
$ref: "#/definitions/User"
responses:
"200":
description: Success
schema:
$ref: "#/definitions/GeneralResponse"
default:
description: Error
schema:
$ref: "#/definitions/ErrorResponse"
/user/source/{sourceId}:
x-swagger-router-controller: userlist
get:
operationId: getOne
description: get a movie
# define the type of response for Success "200" and Error
parameters:
- name: sourceId
type: string
in: path
required: true
responses:
"200":
description: Success
schema:
$ref: "#/definitions/GenearalResponse"
default:
description: Error
schema:
$ref: "#/definitions/ErrorResponse"
put:
operationId: update
description: update a user
# define the parameters
parameters:
- name: sourceName
description: User Properties
in: body
required: true
schema:
$ref: "#/definitions/User"
responses:
"200":
description: Success
schema:
$ref: "#/definitions/GeneralResponse"
default:
description: Error
schema:
$ref: "#/definitions/ErrorResponse"
delete:
operationId: delUser
description: remove a user from database
parameters:
- name: sourceId
description: enter Unique sourceId
type: string
in: path
required: true
responses:
"200":
description: Success
schema:
$ref: "#/definitions/GeneralResponse"
default:
description: Error
schema:
$ref: "#/definitions/ErrorResponse"
/user/source/{sourceId}/schema:
put:
summary: A brief summary of the operation.
description: A brief summary of the operation.
operationId: saveKeyValue
parameters:
- name: sourceId
description: enter Unique sourceId
in: path
required: true
schema:
$ref: "#/definitions/User"
responses:
"200":
description: success
schema:
$ref: "#/definitions/GeneralResponse"
default:
description: Error
schema:
$ref: "#/definitions/ErrorResponse"
get:
description: get the particular user information
operationId: getSchema
parameters:
- name: sourceId
description: enter Unique sourceId
type: string
in: path
required: true
schema:
$ref: "#/definitions/User"
responses:
"200":
description: OK
schema:
$ref: "#/definitions/GeneralResponse"
default:
description: Error
schema:
$ref: "#/definitions/ErrorResponse"
/swagger:
x-swagger-pipe: swagger_raw
# complex objects have schema definitions
definitions:
Schema:
properties:
key:
type: string
value:
type: string
User:
required:
- sourcename
- sourceId
- sourceType
properties:
sourcename:
type: string
sourceId:
type: string
sourceDescription:
type: string
sourceType:
type: string
sourceSchema:
type: object
additionalProperties:
type: string
GeneralResponse:
type: object
properties:
success:
type: number
description: returns 1 if successful
description:
type: string
description: a short comment
required:
- success
- description
ErrorResponse:
required:
- message
properties:
message:
type: string