4 changed files with 158 additions and 256 deletions
@ -1,192 +1,129 @@ |
|||||
{ |
{ |
||||
"swagger": "2.0", |
"swagger": "2.0", |
||||
"info": { |
"info": { |
||||
"version": "1.0.0", |
"title": "Mockup (__THINGS__)", |
||||
"title": "Mockup API", |
"description": "A simple API Mock that manages __THINGS__", |
||||
"description": "A simple API that exposes CRUD operations", |
|
||||
"contact": { |
"contact": { |
||||
"name": "Nicolas Masse" |
"name": "Nicolas Massé", |
||||
|
"url": "https://github.com/nmasse-itix/API-Mockup" |
||||
}, |
}, |
||||
"license": { |
"license": { |
||||
"name": "MIT" |
"name": "MIT License", |
||||
} |
"url": "https://opensource.org/licenses/MIT" |
||||
|
}, |
||||
|
"version": "1.0.0" |
||||
}, |
}, |
||||
"host": "TODO", |
|
||||
"basePath": "/", |
|
||||
"schemes": [ |
|
||||
"https" |
|
||||
], |
|
||||
"consumes": [ |
|
||||
"application/json" |
|
||||
], |
|
||||
"produces": [ |
|
||||
"application/json" |
|
||||
], |
|
||||
"paths": { |
"paths": { |
||||
"/things": { |
"/__THINGS__/": { |
||||
"get": { |
"get": { |
||||
"description": "Returns all available things", |
"summary": "Get all __THINGS__", |
||||
"produces": [ |
"description": "Get all the __THINGS__.", |
||||
"application/json" |
|
||||
], |
|
||||
"responses": { |
"responses": { |
||||
"200": { |
"200": { |
||||
"description": "A List of Things", |
"description": "Success", |
||||
"schema": { |
"schema": { |
||||
"$ref": "#/definitions/ThingsList" |
"type": "array", |
||||
|
"items": { |
||||
|
"type": "#/definitions/PersistedThing" |
||||
|
} |
||||
} |
} |
||||
} |
} |
||||
}, |
} |
||||
|
}, |
||||
|
"post": { |
||||
|
"summary": "Create a __THINGS__", |
||||
"parameters": [ |
"parameters": [ |
||||
{ |
{ |
||||
"$ref": "#/parameters/user-key" |
"name": "body", |
||||
|
"in": "body", |
||||
|
"schema": { |
||||
|
"$ref": "#/definitions/Thing" |
||||
|
} |
||||
} |
} |
||||
] |
|
||||
}, |
|
||||
"post": { |
|
||||
"description": "Create a thing", |
|
||||
"consumes": [ |
|
||||
"application/json" |
|
||||
], |
|
||||
"produces": [ |
|
||||
"application/json" |
|
||||
], |
], |
||||
"responses": { |
"responses": { |
||||
"200": { |
"201": { |
||||
"description": "The created Thing", |
"description": "Success", |
||||
"schema": { |
"schema": { |
||||
"$ref": "#/definitions/Thing" |
"$ref": "#/definitions/PersistedThing" |
||||
} |
} |
||||
} |
} |
||||
}, |
} |
||||
"parameters": [ |
|
||||
{ |
|
||||
"$ref": "#/parameters/user-key" |
|
||||
}, |
|
||||
{ |
|
||||
"$ref": "#/parameters/body" |
|
||||
} |
|
||||
] |
|
||||
} |
} |
||||
}, |
}, |
||||
"/things/{id}": { |
"/__THINGS__/{id}": { |
||||
"get": { |
"get": { |
||||
"description": "Returns all available things", |
"summary": "Get a __THINGS__ by id", |
||||
"produces": [ |
|
||||
"application/json" |
|
||||
], |
|
||||
"responses": { |
"responses": { |
||||
"200": { |
"200": { |
||||
"description": "A List of Things", |
"description": "Success", |
||||
"schema": { |
"schema": { |
||||
"$ref": "#/definitions/ThingsList" |
"$ref": "#/definitions/PersistedThing" |
||||
} |
} |
||||
} |
} |
||||
}, |
} |
||||
|
}, |
||||
|
"put": { |
||||
|
"summary": "Update a __THINGS__", |
||||
"parameters": [ |
"parameters": [ |
||||
{ |
{ |
||||
"$ref": "#/parameters/user-key" |
"name": "body", |
||||
}, |
"in": "body", |
||||
{ |
"schema": { |
||||
"$ref": "#/parameters/id" |
"$ref": "#/definitions/PersistedThing" |
||||
|
} |
||||
} |
} |
||||
] |
|
||||
}, |
|
||||
"put": { |
|
||||
"description": "Update a Thing", |
|
||||
"produces": [ |
|
||||
"application/json" |
|
||||
], |
], |
||||
"responses": { |
"responses": { |
||||
"200": { |
"200": { |
||||
"description": "The updated Thing", |
"description": "Success", |
||||
"schema": { |
"schema": { |
||||
"$ref": "#/definitions/Thing" |
"$ref": "#/definitions/PersistedThing" |
||||
} |
} |
||||
} |
} |
||||
}, |
} |
||||
"parameters": [ |
|
||||
{ |
|
||||
"$ref": "#/parameters/user-key" |
|
||||
}, |
|
||||
{ |
|
||||
"$ref": "#/parameters/id" |
|
||||
}, |
|
||||
{ |
|
||||
"$ref": "#/parameters/body" |
|
||||
} |
|
||||
] |
|
||||
}, |
}, |
||||
"delete": { |
"delete": { |
||||
"description": "Delete a Thing", |
"summary": "Delete a __THINGS__", |
||||
"produces": [ |
|
||||
"application/json" |
|
||||
], |
|
||||
"responses": { |
"responses": { |
||||
"200": { |
"200": { |
||||
"description": "The delete Thing", |
"description": "Success", |
||||
"schema": { |
"schema": { |
||||
"$ref": "#/definitions/Thing" |
"$ref": "#/definitions/PersistedThing" |
||||
} |
} |
||||
} |
} |
||||
}, |
} |
||||
"parameters": [ |
}, |
||||
{ |
"parameters": [ |
||||
"$ref": "#/parameters/user-key" |
{ |
||||
}, |
"name": "id", |
||||
{ |
"in": "path", |
||||
"$ref": "#/parameters/id" |
"description": "The __THINGS__ id", |
||||
} |
"required": true, |
||||
] |
"type": "integer" |
||||
} |
} |
||||
|
] |
||||
} |
} |
||||
}, |
}, |
||||
"definitions": { |
"definitions": { |
||||
"ThingsList": { |
|
||||
"type": "array", |
|
||||
"items": { |
|
||||
"$ref": "#/definitions/Thing" |
|
||||
} |
|
||||
}, |
|
||||
"Thing": { |
"Thing": { |
||||
|
"title": "Definition of __THINGS__", |
||||
|
"description": "All __THINGS__ follow this definition", |
||||
|
"type": "object", |
||||
|
"properties": { } |
||||
|
}, |
||||
|
"PersistedThing": { |
||||
|
"title": "Definition of persisted __THINGS__", |
||||
|
"description": "All persisted __THINGS__ follow this definition", |
||||
"type": "object", |
"type": "object", |
||||
"properties": { |
"properties": { |
||||
"name": { |
|
||||
"type": "string" |
|
||||
}, |
|
||||
"id": { |
"id": { |
||||
"type": "number" |
"format": "int32", |
||||
}, |
"description": "The __THINGS__ id", |
||||
"price": { |
"type": "integer", |
||||
"type": "number" |
"required": true |
||||
} |
} |
||||
} |
} |
||||
} |
} |
||||
}, |
|
||||
"parameters": { |
|
||||
"user-key": { |
|
||||
"name": "user-key", |
|
||||
"in": "header", |
|
||||
"required": true, |
|
||||
"description": "The 3scale API Key", |
|
||||
"type": "string", |
|
||||
"x-data-threescale-name": "user_keys" |
|
||||
}, |
|
||||
"id": { |
|
||||
"name": "id", |
|
||||
"in": "path", |
|
||||
"required": true, |
|
||||
"description": "The things id", |
|
||||
"type": "number" |
|
||||
}, |
|
||||
"body": { |
|
||||
"name": "body", |
|
||||
"in": "body", |
|
||||
"required": true, |
|
||||
"description": "The Thing to create/update", |
|
||||
"schema": { |
|
||||
"$ref": "#/definitions/Thing" |
|
||||
} |
|
||||
} |
|
||||
} |
} |
||||
} |
} |
||||
|
|||||
@ -1,119 +0,0 @@ |
|||||
--- |
|
||||
swagger: "2.0" |
|
||||
info: |
|
||||
version: "1.0.0" |
|
||||
title: "Mockup API" |
|
||||
description: "A simple API that exposes CRUD operations" |
|
||||
contact: |
|
||||
name: "Nicolas Masse" |
|
||||
license: |
|
||||
name: "MIT" |
|
||||
host: "TODO" |
|
||||
basePath: "/" |
|
||||
schemes: |
|
||||
- "https" |
|
||||
consumes: |
|
||||
- "application/json" |
|
||||
produces: |
|
||||
- "application/json" |
|
||||
paths: |
|
||||
'/things': |
|
||||
get: |
|
||||
description: "Returns all available things" |
|
||||
produces: |
|
||||
- "application/json" |
|
||||
responses: |
|
||||
"200": |
|
||||
description: "A List of Things" |
|
||||
schema: |
|
||||
$ref: "#/definitions/ThingsList" |
|
||||
parameters: |
|
||||
- $ref: "#/parameters/user-key" |
|
||||
post: |
|
||||
description: "Create a thing" |
|
||||
consumes: |
|
||||
- "application/json" |
|
||||
produces: |
|
||||
- "application/json" |
|
||||
responses: |
|
||||
"200": |
|
||||
description: "The created Thing" |
|
||||
schema: |
|
||||
$ref: "#/definitions/Thing" |
|
||||
parameters: |
|
||||
- $ref: "#/parameters/user-key" |
|
||||
- $ref: "#/parameters/body" |
|
||||
'/things/{id}': |
|
||||
get: |
|
||||
description: "Returns all available things" |
|
||||
produces: |
|
||||
- "application/json" |
|
||||
responses: |
|
||||
"200": |
|
||||
description: "A List of Things" |
|
||||
schema: |
|
||||
$ref: "#/definitions/ThingsList" |
|
||||
parameters: |
|
||||
- $ref: "#/parameters/user-key" |
|
||||
- $ref: "#/parameters/id" |
|
||||
put: |
|
||||
description: "Update a Thing" |
|
||||
produces: |
|
||||
- "application/json" |
|
||||
responses: |
|
||||
"200": |
|
||||
description: "The updated Thing" |
|
||||
schema: |
|
||||
$ref: "#/definitions/Thing" |
|
||||
parameters: |
|
||||
- $ref: "#/parameters/user-key" |
|
||||
- $ref: "#/parameters/id" |
|
||||
- $ref: "#/parameters/body" |
|
||||
delete: |
|
||||
description: "Delete a Thing" |
|
||||
produces: |
|
||||
- "application/json" |
|
||||
responses: |
|
||||
"200": |
|
||||
description: "The delete Thing" |
|
||||
schema: |
|
||||
$ref: "#/definitions/Thing" |
|
||||
parameters: |
|
||||
- $ref: "#/parameters/user-key" |
|
||||
- $ref: "#/parameters/id" |
|
||||
definitions: |
|
||||
ThingsList: |
|
||||
type: "array" |
|
||||
items: |
|
||||
$ref: "#/definitions/Thing" |
|
||||
Thing: |
|
||||
type: "object" |
|
||||
properties: |
|
||||
name: |
|
||||
type: "string" |
|
||||
id: |
|
||||
type: "number" |
|
||||
price: |
|
||||
type: "number" |
|
||||
parameters: |
|
||||
user-key: |
|
||||
name: "user-key" |
|
||||
in: "header" |
|
||||
required: true |
|
||||
description: "The 3scale API Key" |
|
||||
type: "string" |
|
||||
x-data-threescale-name: "user_keys" |
|
||||
id: |
|
||||
name: "id" |
|
||||
in: "path" |
|
||||
required: true |
|
||||
description: "The things id" |
|
||||
type: "number" |
|
||||
body: |
|
||||
name: "body" |
|
||||
in: "body" |
|
||||
required: true |
|
||||
description: "The Thing to create/update" |
|
||||
schema: |
|
||||
$ref: "#/definitions/Thing" |
|
||||
|
|
||||
Loading…
Reference in new issue