Skip to content

Instantly share code, notes, and snippets.

@Markbnj
Last active April 22, 2016 19:43
Show Gist options
  • Save Markbnj/19c14fd5165bf098927fa131b5d83dc3 to your computer and use it in GitHub Desktop.
Save Markbnj/19c14fd5165bf098927fa131b5d83dc3 to your computer and use it in GitHub Desktop.
swagger: '2.0'
info:
title: My Cars API
description: Simple API for demonstrating json validation
version: 1.0.0
host: localhost
schemes:
- http
produces:
- application/json
definitions:
Registration:
type: object
required:
- state
- plate_number
properties:
state:
type: string
description: Two letter state abbreviation code
pattern: '^[A-Z]{2}$'
plate_number:
type: string
description: The license plate number
minLength: 1
maxLength: 8
Car:
type: object
required:
- make
- model
- model_year
- doors
- vin
- color
properties:
make:
type: string
description: The name of the vehicle manufacturer
model:
type: string
description: The name of the vehicle model
model_year:
type: string
description: The manufacturers model year
pattern: '^[0-9]{2,4}$'
minLength: 2
doors:
type: integer
description: The number of doors
minimum: 2
maximum: 5
vin:
type: string
description: The vehicle VIN number
pattern: '^[a-zA-Z0-9]{17}$'
color:
type: string
description: Manufacturers vehicle color
registration:
$ref: '#/definitions/Registration'
Cars:
type: object
required:
- results
properties:
results:
type: array
items:
$ref: '#/definitions/Car'
description: list of Car objects
Error:
type: object
properties:
code:
type: integer
description: the http status code
minimum: 400
maximum: 599
message:
type: string
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment