Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
129 lines (126 sloc) 3.26 KB
swagger: "2.0"
info:
title: Guestbook App
description: Insert and display guestbook entries.
version: 0.0.1
termsOfService: http://www.aaron.de/about/
contact:
name: Aaron Kreis
url: http://www.aaron.de
email: mail@aaron.de
license:
name: Apache 2.0
url: http://www.apache.org/licenses/LICENSE-2.0.html
schemes:
- http
- https
host: localhost:10010
basePath: /guestbook # localhost/guestbook
paths:
/entries: # localhost/guestbook/entries
x-swagger-router-controller: getAllEntries # route handler
get:
description: Returns a list containing all entries.
operationId: getAllEntries # MOC function which will return all the moc entries
parameters: # add parameter to /entries e.g. paging capabilities - /entries?pageSize=10&pageNumber=1
- $ref: "#/parameters/pageSize"
- $ref: "#/parameters/pageNumber"
# - name: pageSize
# in: query
# description: Number of entries returned
# type: integer
# - name: pageNumber
# in: query
# description: Page number
# type: integer
responses:
200:
description: A list of entries
schema:
$ref: "#/definitions/Entries" # entries array
#type: array
#items:
# required: # all values are required
# - email
# - message
# properties:
# id:
# type: integer
# email:
# type: string
# message:
# type: string
500:
$ref: "#/responses/Standard500ErrorResponse"
post:
summary: Creates an entry
description: Adds a new entry to the entries list.
parameters:
- name: entry
in: body
description: The entry to create.
schema:
$ref: "#/definitions/Entry"
responses:
204:
description: Entry succesfully created.
400:
description: Entry couldn't have been created.
500:
$ref: "#/responses/Standard500ErrorResponse"
/entries/{id}:
get:
description: Returns a single entry for its id
parameters:
- name: id
in: path
required: true
description: The entry's id
type: string
responses:
200:
description: An Entry
schema:
$ref: "#/definitions/Entry"
404:
description: The Entry does not exists.
500:
$ref: "#/responses/Standard500ErrorResponse"
definitions:
Entry:
required:
- email
- message
properties:
id:
type: integer
email:
type: string
message:
type: string
Entries:
type: array
items:
$ref: "#/definitions/Entry"
Error:
properties:
code:
type: string
message:
type: string
responses:
Standard500ErrorResponse:
description: An unexpected error occured.
schema:
$ref: "#/definitions/Error"
parameters:
pageSize:
name: pageSize
in: query
description: Number of entries returned
type: integer
pageNumber:
name: pageNumber
in: query
description: Page number
type: integer