From 697457415d30a8d0bdfade16fed9013472745c76 Mon Sep 17 00:00:00 2001 From: Tony Tam Date: Mon, 10 Nov 2014 21:18:19 -0800 Subject: [PATCH] updated spec with auth --- src/test/resources/petstore.json | 283 +++++++++++++++++++++++++++---- 1 file changed, 249 insertions(+), 34 deletions(-) diff --git a/src/test/resources/petstore.json b/src/test/resources/petstore.json index 1f450a3b097..a4de6acac86 100644 --- a/src/test/resources/petstore.json +++ b/src/test/resources/petstore.json @@ -1,5 +1,5 @@ { - "swagger": 2.0, + "swagger": "2.0", "info": { "description": "This is a sample server Petstore server. You can find out more about Swagger at http://swagger.wordnik.com or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters", "version": "1.0.0", @@ -13,7 +13,11 @@ "url": "http://www.apache.org/licenses/LICENSE-2.0.html" } }, + "host": "petstore.swagger.wordnik.com", "basePath": "/v2", + "schemes": [ + "http" + ], "paths": { "/pet": { "post": { @@ -34,7 +38,7 @@ "parameters": [ { "in": "body", - "name": "body", + "name": "pet", "description": "Pet object that needs to be added to the store", "required": false, "schema": { @@ -46,7 +50,15 @@ "405": { "description": "Invalid input" } - } + }, + "security": [ + { + "petstore_auth": [ + "write:pets", + "read:pets" + ] + } + ] }, "put": { "tags": [ @@ -84,7 +96,15 @@ "400": { "description": "Invalid ID supplied" } - } + }, + "security": [ + { + "petstore_auth": [ + "write:pets", + "read:pets" + ] + } + ] } }, "/pet/findByStatus": { @@ -109,7 +129,7 @@ "items": { "type": "string" }, - "collectionFormat": "default" + "collectionFormat": "multi" } ], "responses": { @@ -125,7 +145,15 @@ "400": { "description": "Invalid status value" } - } + }, + "security": [ + { + "petstore_auth": [ + "write:pets", + "read:pets" + ] + } + ] } }, "/pet/findByTags": { @@ -150,7 +178,7 @@ "items": { "type": "string" }, - "collectionFormat": "default" + "collectionFormat": "multi" } ], "responses": { @@ -166,7 +194,15 @@ "400": { "description": "Invalid tag value" } - } + }, + "security": [ + { + "petstore_auth": [ + "write:pets", + "read:pets" + ] + } + ] } }, "/pet/{petId}": { @@ -204,7 +240,69 @@ "400": { "description": "Invalid ID supplied" } - } + }, + "security": [ + { + "api_key": [] + }, + { + "petstore_auth": [ + "write:pets", + "read:pets" + ] + } + ] + }, + "post": { + "tags": [ + "pet" + ], + "summary": "Updates a pet in the store with form data", + "description": "", + "operationId": "updatePetWithForm", + "consumes": [ + "application/x-www-form-urlencoded" + ], + "produces": [ + "application/json", + "application/xml" + ], + "parameters": [ + { + "in": "path", + "name": "petId", + "description": "ID of pet that needs to be updated", + "required": true, + "type": "string" + }, + { + "in": "formData", + "name": "name", + "description": "Updated name of the pet", + "required": true, + "type": "string" + }, + { + "in": "formData", + "name": "status", + "description": "Updated status of the pet", + "required": true, + "type": "string" + } + ], + "responses": { + "405": { + "description": "Invalid input" + } + }, + "security": [ + { + "petstore_auth": [ + "write:pets", + "read:pets" + ] + } + ] }, "delete": { "tags": [ @@ -218,6 +316,13 @@ "application/xml" ], "parameters": [ + { + "in": "header", + "name": "api_key", + "description": "", + "required": true, + "type": "string" + }, { "in": "path", "name": "petId", @@ -231,7 +336,15 @@ "400": { "description": "Invalid pet value" } - } + }, + "security": [ + { + "petstore_auth": [ + "write:pets", + "read:pets" + ] + } + ] } }, "/store/order": { @@ -258,6 +371,12 @@ } ], "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/Order" + } + }, "400": { "description": "Invalid Order" } @@ -591,122 +710,218 @@ } } }, + "securityDefinitions": { + "api_key": { + "type": "apiKey", + "name": "api_key", + "in": "header" + }, + "petstore_auth": { + "type": "oauth2", + "authorizationUrl": "http://petstore.swagger.wordnik.com/api/oauth/dialog", + "flow": "implicit" + } + }, "definitions": { "User": { "properties": { "id": { "type": "integer", - "format": "int64" + "format": "int64", + "xml": { + "name": "id" + } }, "username": { - "type": "string" + "type": "string", + "xml": { + "name": "username" + } }, "firstName": { - "type": "string" + "type": "string", + "xml": { + "name": "firstName" + } }, "lastName": { - "type": "string" + "type": "string", + "xml": { + "name": "lastName" + } }, "email": { - "type": "string" + "type": "string", + "xml": { + "name": "email" + } }, "password": { - "type": "string" + "type": "string", + "xml": { + "name": "password" + } }, "phone": { - "type": "string" + "type": "string", + "xml": { + "name": "phone" + } }, "userStatus": { "type": "integer", "format": "int32", - "position": 0 + "xml": { + "name": "userStatus" + }, + "description": "User Status" } + }, + "xml": { + "name": "User" } }, "Category": { "properties": { "id": { "type": "integer", - "format": "int64" + "format": "int64", + "xml": { + "name": "id" + } }, "name": { - "type": "string" + "type": "string", + "xml": { + "name": "name" + } } + }, + "xml": { + "name": "Category" } }, "Pet": { - "description": "A single pet in the store", "required": [ "name", "photoUrls" ], "properties": { "id": { - "description": "the identifier for the pet", "type": "integer", - "format": "int64" + "format": "int64", + "xml": { + "name": "id" + } }, "category": { + "xml": { + "name": "category" + }, "$ref": "Category" }, "name": { "type": "string", "example": "doggie", - "position": 0 + "xml": { + "name": "name" + } }, "photoUrls": { "type": "array", + "xml": { + "name": "photoUrl", + "wrapped": true + }, "items": { "type": "string" } }, "tags": { "type": "array", + "xml": { + "name": "tag", + "wrapped": true + }, "items": { "$ref": "Tag" } }, "status": { "type": "string", - "position": 0 + "xml": { + "name": "status" + }, + "description": "pet status in the store" } + }, + "xml": { + "name": "Pet" } }, "Tag": { - "required": [ "id", "name" ], "properties": { "id": { "type": "integer", - "format": "int64" + "format": "int64", + "xml": { + "name": "id" + } }, "name": { - "type": "string" + "type": "string", + "xml": { + "name": "name" + } } + }, + "xml": { + "name": "Tag" } }, "Order": { - "required": [ "id" ], "properties": { "id": { "type": "integer", - "format": "int64" + "format": "int64", + "xml": { + "name": "id" + } }, "petId": { "type": "integer", - "format": "int64" + "format": "int64", + "xml": { + "name": "petId" + } }, "quantity": { "type": "integer", - "format": "int32" + "format": "int32", + "xml": { + "name": "quantity" + } }, "shipDate": { "type": "string", - "format": "date-time" + "format": "date-time", + "xml": { + "name": "shipDate" + } }, "status": { "type": "string", - "position": 0 + "xml": { + "name": "status" + }, + "description": "Order Status" + }, + "complete": { + "type": "boolean" } + }, + "xml": { + "name": "Order" } } }