updated spec with auth

This commit is contained in:
Tony Tam 2014-11-10 21:18:19 -08:00
parent bcfd2e8ab6
commit 697457415d

View File

@ -1,5 +1,5 @@
{ {
"swagger": 2.0, "swagger": "2.0",
"info": { "info": {
"description": "This is a sample server Petstore server. You can find out more about Swagger at <a href=\"http://swagger.wordnik.com\">http://swagger.wordnik.com</a> or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters", "description": "This is a sample server Petstore server. You can find out more about Swagger at <a href=\"http://swagger.wordnik.com\">http://swagger.wordnik.com</a> 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", "version": "1.0.0",
@ -13,7 +13,11 @@
"url": "http://www.apache.org/licenses/LICENSE-2.0.html" "url": "http://www.apache.org/licenses/LICENSE-2.0.html"
} }
}, },
"host": "petstore.swagger.wordnik.com",
"basePath": "/v2", "basePath": "/v2",
"schemes": [
"http"
],
"paths": { "paths": {
"/pet": { "/pet": {
"post": { "post": {
@ -34,7 +38,7 @@
"parameters": [ "parameters": [
{ {
"in": "body", "in": "body",
"name": "body", "name": "pet",
"description": "Pet object that needs to be added to the store", "description": "Pet object that needs to be added to the store",
"required": false, "required": false,
"schema": { "schema": {
@ -46,7 +50,15 @@
"405": { "405": {
"description": "Invalid input" "description": "Invalid input"
} }
} },
"security": [
{
"petstore_auth": [
"write:pets",
"read:pets"
]
}
]
}, },
"put": { "put": {
"tags": [ "tags": [
@ -84,7 +96,15 @@
"400": { "400": {
"description": "Invalid ID supplied" "description": "Invalid ID supplied"
} }
} },
"security": [
{
"petstore_auth": [
"write:pets",
"read:pets"
]
}
]
} }
}, },
"/pet/findByStatus": { "/pet/findByStatus": {
@ -109,7 +129,7 @@
"items": { "items": {
"type": "string" "type": "string"
}, },
"collectionFormat": "default" "collectionFormat": "multi"
} }
], ],
"responses": { "responses": {
@ -125,7 +145,15 @@
"400": { "400": {
"description": "Invalid status value" "description": "Invalid status value"
} }
} },
"security": [
{
"petstore_auth": [
"write:pets",
"read:pets"
]
}
]
} }
}, },
"/pet/findByTags": { "/pet/findByTags": {
@ -150,7 +178,7 @@
"items": { "items": {
"type": "string" "type": "string"
}, },
"collectionFormat": "default" "collectionFormat": "multi"
} }
], ],
"responses": { "responses": {
@ -166,7 +194,15 @@
"400": { "400": {
"description": "Invalid tag value" "description": "Invalid tag value"
} }
} },
"security": [
{
"petstore_auth": [
"write:pets",
"read:pets"
]
}
]
} }
}, },
"/pet/{petId}": { "/pet/{petId}": {
@ -204,7 +240,69 @@
"400": { "400": {
"description": "Invalid ID supplied" "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": { "delete": {
"tags": [ "tags": [
@ -218,6 +316,13 @@
"application/xml" "application/xml"
], ],
"parameters": [ "parameters": [
{
"in": "header",
"name": "api_key",
"description": "",
"required": true,
"type": "string"
},
{ {
"in": "path", "in": "path",
"name": "petId", "name": "petId",
@ -231,7 +336,15 @@
"400": { "400": {
"description": "Invalid pet value" "description": "Invalid pet value"
} }
} },
"security": [
{
"petstore_auth": [
"write:pets",
"read:pets"
]
}
]
} }
}, },
"/store/order": { "/store/order": {
@ -258,6 +371,12 @@
} }
], ],
"responses": { "responses": {
"200": {
"description": "successful operation",
"schema": {
"$ref": "#/definitions/Order"
}
},
"400": { "400": {
"description": "Invalid Order" "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": { "definitions": {
"User": { "User": {
"properties": { "properties": {
"id": { "id": {
"type": "integer", "type": "integer",
"format": "int64" "format": "int64",
"xml": {
"name": "id"
}
}, },
"username": { "username": {
"type": "string" "type": "string",
"xml": {
"name": "username"
}
}, },
"firstName": { "firstName": {
"type": "string" "type": "string",
"xml": {
"name": "firstName"
}
}, },
"lastName": { "lastName": {
"type": "string" "type": "string",
"xml": {
"name": "lastName"
}
}, },
"email": { "email": {
"type": "string" "type": "string",
"xml": {
"name": "email"
}
}, },
"password": { "password": {
"type": "string" "type": "string",
"xml": {
"name": "password"
}
}, },
"phone": { "phone": {
"type": "string" "type": "string",
"xml": {
"name": "phone"
}
}, },
"userStatus": { "userStatus": {
"type": "integer", "type": "integer",
"format": "int32", "format": "int32",
"position": 0 "xml": {
"name": "userStatus"
},
"description": "User Status"
} }
},
"xml": {
"name": "User"
} }
}, },
"Category": { "Category": {
"properties": { "properties": {
"id": { "id": {
"type": "integer", "type": "integer",
"format": "int64" "format": "int64",
"xml": {
"name": "id"
}
}, },
"name": { "name": {
"type": "string" "type": "string",
"xml": {
"name": "name"
}
} }
},
"xml": {
"name": "Category"
} }
}, },
"Pet": { "Pet": {
"description": "A single pet in the store",
"required": [ "required": [
"name", "name",
"photoUrls" "photoUrls"
], ],
"properties": { "properties": {
"id": { "id": {
"description": "the identifier for the pet",
"type": "integer", "type": "integer",
"format": "int64" "format": "int64",
"xml": {
"name": "id"
}
}, },
"category": { "category": {
"xml": {
"name": "category"
},
"$ref": "Category" "$ref": "Category"
}, },
"name": { "name": {
"type": "string", "type": "string",
"example": "doggie", "example": "doggie",
"position": 0 "xml": {
"name": "name"
}
}, },
"photoUrls": { "photoUrls": {
"type": "array", "type": "array",
"xml": {
"name": "photoUrl",
"wrapped": true
},
"items": { "items": {
"type": "string" "type": "string"
} }
}, },
"tags": { "tags": {
"type": "array", "type": "array",
"xml": {
"name": "tag",
"wrapped": true
},
"items": { "items": {
"$ref": "Tag" "$ref": "Tag"
} }
}, },
"status": { "status": {
"type": "string", "type": "string",
"position": 0 "xml": {
"name": "status"
},
"description": "pet status in the store"
} }
},
"xml": {
"name": "Pet"
} }
}, },
"Tag": { "Tag": {
"required": [ "id", "name" ],
"properties": { "properties": {
"id": { "id": {
"type": "integer", "type": "integer",
"format": "int64" "format": "int64",
"xml": {
"name": "id"
}
}, },
"name": { "name": {
"type": "string" "type": "string",
"xml": {
"name": "name"
}
} }
},
"xml": {
"name": "Tag"
} }
}, },
"Order": { "Order": {
"required": [ "id" ],
"properties": { "properties": {
"id": { "id": {
"type": "integer", "type": "integer",
"format": "int64" "format": "int64",
"xml": {
"name": "id"
}
}, },
"petId": { "petId": {
"type": "integer", "type": "integer",
"format": "int64" "format": "int64",
"xml": {
"name": "petId"
}
}, },
"quantity": { "quantity": {
"type": "integer", "type": "integer",
"format": "int32" "format": "int32",
"xml": {
"name": "quantity"
}
}, },
"shipDate": { "shipDate": {
"type": "string", "type": "string",
"format": "date-time" "format": "date-time",
"xml": {
"name": "shipDate"
}
}, },
"status": { "status": {
"type": "string", "type": "string",
"position": 0 "xml": {
"name": "status"
},
"description": "Order Status"
},
"complete": {
"type": "boolean"
} }
},
"xml": {
"name": "Order"
} }
} }
} }