Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- swagger: "2.0"
- info:
- version: "0.0.1"
- title: Hello World App
- # 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
- - text/html
- - text/plain; charset=UTF-8
- # format of the responses to the client (Accepts)
- produces:
- - application/json
- - text/plain; charset=UTF-8
- - text/html
- paths:
- /movie:
- # our controller name
- x-swagger-router-controller: movie
- get:
- operationId: getAll
- description: get the movies list
- # define the type of response for Success "200" and Error
- responses:
- "200":
- description: Success
- schema:
- $ref: "#/definitions/GetMoviesListResponse"
- default:
- description: Error
- schema:
- $ref: "#/definitions/ErrorResponse"
- post:
- operationId: save
- description: add a new movie to the list
- # movie info to be stored
- parameters:
- - name: title
- description: Movie properties
- in: body
- required: true
- schema:
- $ref: "#/definitions/Movie"
- responses:
- "200":
- description: Success
- schema:
- $ref: "#/definitions/GeneralResponse"
- default:
- description: Error
- schema:
- $ref: "#/definitions/ErrorResponse"
- /movie/{id}:
- # our controller name
- x-swagger-router-controller: movie
- get:
- operationId: getOne
- description: get a movie
- # define the type of response for Success "200" and Error
- parameters:
- - name: id
- type: string
- in: path
- required: true
- responses:
- "200":
- description: Success
- schema:
- $ref: "#/definitions/GetMovieResponse"
- default:
- description: Error
- schema:
- $ref: "#/definitions/ErrorResponse"
- /swagger:
- x-swagger-pipe: swagger_raw
- # complex objects have schema definitions
- definitions:
- ErrorResponse:
- required:
- - message
- properties:
- message:
- type: string
- GetMoviesListResponse:
- required:
- - movies
- properties:
- # The array of movies
- movies:
- type: array
- items:
- type: object
- properties:
- id:
- type: string
- title:
- type: string
- year:
- type: number
- Movie:
- type: object
- properties:
- title:
- type: string
- description: task object name
- year:
- type: number
- description: task description
- required:
- - title
- - year
- GeneralResponse:
- type: object
- properties:
- success:
- type: number
- description: returns 1 if successful
- description:
- type: string
- description: a short comment
- required:
- - success
- - description
- GetMovieResponse:
- required:
- - id
- - title
- - year
- properties:
- id:
- type: string
- title:
- type: string
- year:
- type: number
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement