Skip to content

Instantly share code, notes, and snippets.

@mauricedb
Last active October 23, 2016 15:07
Show Gist options
  • Save mauricedb/5f8bee6ecfaa4584c43e4d8f67dda848 to your computer and use it in GitHub Desktop.
Save mauricedb/5f8bee6ecfaa4584c43e4d8f67dda848 to your computer and use it in GitHub Desktop.
# Code completion support is available so start typing for available options.
swagger: '2.0'
# This is your document metadata
info:
version: "1.0.1"
title: The movie database
# Describe your paths here
paths:
# This is a path endpoint. Change it.
/movies:
# This is a HTTP operation
get:
# Describe this verb here. Note: you can use markdown
description: Returns all movies
operationId: getMovies
# Expected responses for this operation:
responses:
# Response code
200:
description: Successful response
# A schema describing your response object.
# Use JSON Schema format
schema:
title: ArrayOfMovies
type: array
items:
$ref: '#/definitions/movie'
default:
description: Error
schema:
$ref: 'https://zalando.github.io/problem/schema.yaml#/Problem'
post:
description: Add a new movie
operationId: addMovie
parameters:
- name: movie
in: body
description: The new movie
required: true
schema:
$ref: '#/definitions/movie'
responses:
'201':
description: The new movie
schema:
$ref: '#/definitions/movie'
default:
description: Error
schema:
$ref: 'https://zalando.github.io/problem/schema.yaml#/Problem'
/movies/{id}:
parameters:
- name: id
in: path
description: ID of the movie
required: true
type: integer
format: int64
get:
description: Returns a single movie
operationId: getMovieById
responses:
200:
description: Successful response
schema:
$ref: '#/definitions/movie'
default:
description: Error
schema:
$ref: 'https://zalando.github.io/problem/schema.yaml#/Problem'
put:
description: Update an existing movie
operationId: updateMovieById
parameters:
- name: movie
in: body
description: The movie
required: true
schema:
$ref: '#/definitions/movie'
responses:
'200':
description: The new movie
schema:
$ref: '#/definitions/movie'
default:
description: Error
schema:
$ref: 'https://zalando.github.io/problem/schema.yaml#/Problem'
delete:
description: Delete a movie
operationId: deleteMovieById
responses:
'204':
description: Movie deleted
default:
description: Error
schema:
$ref: 'https://zalando.github.io/problem/schema.yaml#/Problem'
definitions:
movie:
type: object
required:
- id
- title
properties:
id:
type: integer
format: int64
title:
type: string
ratings:
type: object
properties:
criticsScore:
type: integer
minimum: 0
maximum: 100
audienceScore:
type: integer
minimum: 0
maximum: 100
criticsConsensus:
type: string
abridgedDirectors:
type: array
items:
type: string
abridgedCast:
type: array
items:
$ref: '#/definitions/cast'
posters:
$ref: '#/definitions/posters'
cast:
type: object
required:
- id
- name
properties:
id:
type: integer
format: int64
name:
type: string
characters:
type: array
items:
type: string
posters:
properties:
thumbnail:
type: string
format: uri
profile:
type: string
format: uri
detailed:
type: string
format: uri
original:
type: string
format: uri
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment