First iteration of rspec driven swagger

This commit is contained in:
domaindrivendev
2016-04-06 09:19:41 -07:00
parent d579dab7d8
commit 63861a3940
17 changed files with 312 additions and 445 deletions

View File

@@ -1,122 +1,79 @@
{
"swagger": "2.0",
"info": {
"version": "0.0.0",
"title": "Dummy app for testing swagger_rails"
},
"paths": {
"/blogs": {
"post": {
"description": "Creates a new Blog",
"parameters": [
{
"name": "X-Forwarded-For",
"in": "header",
"type": "string",
"default": "client1"
},
{
"name": "blog",
"in": "body",
"schema": {
"$ref": "#/definitions/Blog"
}
}
],
"responses": {
"201": {
"description": "Created",
"schema": {
"$ref": "#/definitions/Blog"
}
},
"400": {
"description": "Invalid Request",
"schema": {
"$ref": "#/definitions/RequestError"
}
}
}
},
"get": {
"description": "Searches Bloggs",
"parameters": [
{
"name": "published",
"in": "query",
"type": "boolean",
"default": "true"
},
{
"name": "keywords",
"in": "query",
"type": "string",
"default": "Ruby on Rails"
}
],
"responses": {
"200": {
"description": "Ok",
"schema": {
"type": "array",
"item": {
"$ref": "#/definitions/Blog"
}
}
}
}
}
},
"/blogs/{id}": {
"get": {
"description": "Retrieves a specific Blog by unique ID",
"parameters": [
{
"name": "id",
"in": "path",
"type": "string",
"default": "123"
}
],
"responses": {
"200": {
"description": "Ok",
"schema": {
"$ref": "#/definitions/Blog"
}
}
}
}
}
},
"definitions": {
"Blog": {
"properties": {
"swagger": "2.0",
"info": {
"title": "API V1",
"version": "v1"
},
"paths": {
"/blogs": {
"post": {
"summary": "creates a new blog",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"parameters": [
{
"name": "blog",
"in": "body",
"schema": {
"type": "object",
"properties": {
"title": {
"type": "string"
"type": "string"
},
"content": {
"type": "string",
"format": "date-time"
"type": "string"
}
},
"example": {
"title": "Test Blog",
"content": "Hello World"
}
},
"RequestError": {
"type": "object",
"additionalProperties": {
"type": "array",
"item": {
"type": "string"
}
},
"example": {
"title": [ "is required" ]
}
}
],
"responses": {
"201": {
"description": "valid request"
},
"422": {
"description": "invalid request"
}
}
},
"get": {
"summary": "searches existing blogs",
"produces": [
"application/json"
],
"parameters": [
],
"responses": {
"200": {
"description": "valid request"
}
}
}
},
"/blogs/{id}": {
"get": {
"summary": "retreives a specific blog",
"produces": [
"application/json"
],
"parameters": [
{
"name": "id",
"in": "path",
"type": "string"
}
],
"responses": {
"200": {
"description": "blog found"
}
}
}
}
}
}
}