111 lines
2.4 KiB
YAML
111 lines
2.4 KiB
YAML
swagger: '2.0'
|
|
info:
|
|
title: Hello API
|
|
version: "0.1"
|
|
|
|
paths:
|
|
/greeting:
|
|
get:
|
|
operationId: api.say_hello
|
|
summary: Returns a greeting
|
|
parameters:
|
|
- name: name
|
|
in: query
|
|
type: string
|
|
responses:
|
|
200:
|
|
description: Successful response.
|
|
schema:
|
|
type: object
|
|
properties:
|
|
message:
|
|
type: string
|
|
description: Message greeting
|
|
/hero/{id}:
|
|
get:
|
|
operationId: heroes.get_hero
|
|
summary: Returns hero by id
|
|
parameters:
|
|
- name: id
|
|
in: path
|
|
type: integer
|
|
required: true
|
|
responses:
|
|
200:
|
|
description: Successful response.
|
|
schema:
|
|
$ref: '#/definitions/Hero'
|
|
404:
|
|
description: Hero not found
|
|
500:
|
|
description: Some server error
|
|
put:
|
|
operationId: heroes.put_hero
|
|
summary: Update a hero
|
|
parameters:
|
|
- name: id
|
|
in: path
|
|
type: integer
|
|
required: true
|
|
- name: hero
|
|
in: body
|
|
required: true
|
|
schema:
|
|
$ref: '#/definitions/Hero'
|
|
responses:
|
|
200:
|
|
description: Hero updated
|
|
403:
|
|
description: Some error
|
|
409:
|
|
description: Duplicate name
|
|
404:
|
|
description: Hero not found
|
|
500:
|
|
description: Some server error
|
|
/hero:
|
|
post:
|
|
operationId: heroes.post_hero
|
|
summary: Insert a hero
|
|
parameters:
|
|
- name: hero
|
|
in: body
|
|
required: true
|
|
schema:
|
|
$ref: '#/definitions/Hero'
|
|
responses:
|
|
200:
|
|
description: Hero inserted
|
|
403:
|
|
description: Some error
|
|
409:
|
|
description: Duplicate name
|
|
500:
|
|
description: Some server error
|
|
/heroes:
|
|
get:
|
|
operationId: heroes.get_heroes
|
|
summary: Returns all heroes
|
|
responses:
|
|
200:
|
|
description: Successful response.
|
|
schema:
|
|
type: array
|
|
items:
|
|
$ref: '#/definitions/Hero'
|
|
404:
|
|
description: No heroes available
|
|
500:
|
|
description: Some server error
|
|
|
|
|
|
definitions:
|
|
Hero:
|
|
description: Hero type
|
|
type: object
|
|
properties:
|
|
id:
|
|
type: integer
|
|
name:
|
|
type: string
|