From fbc09aa77bee73951771563240ef99fa29ed4a51 Mon Sep 17 00:00:00 2001 From: Tony Tam Date: Tue, 30 Jul 2013 23:55:05 -0700 Subject: [PATCH] renamed to separate spec versions --- .../{petstore => petstore-1.1}/pet.json | 0 .../{petstore => petstore-1.1}/resources.json | 0 .../{petstore => petstore-1.1}/store.json | 0 .../{petstore => petstore-1.1}/user.json | 0 src/test/resources/petstore-1.2/api-docs | 57 ++++ src/test/resources/petstore-1.2/pet | 284 ++++++++++++++++++ src/test/resources/petstore-1.2/store | 140 +++++++++ src/test/resources/petstore-1.2/user | 280 +++++++++++++++++ 8 files changed, 761 insertions(+) rename src/test/resources/{petstore => petstore-1.1}/pet.json (100%) rename src/test/resources/{petstore => petstore-1.1}/resources.json (100%) rename src/test/resources/{petstore => petstore-1.1}/store.json (100%) rename src/test/resources/{petstore => petstore-1.1}/user.json (100%) create mode 100644 src/test/resources/petstore-1.2/api-docs create mode 100644 src/test/resources/petstore-1.2/pet create mode 100644 src/test/resources/petstore-1.2/store create mode 100644 src/test/resources/petstore-1.2/user diff --git a/src/test/resources/petstore/pet.json b/src/test/resources/petstore-1.1/pet.json similarity index 100% rename from src/test/resources/petstore/pet.json rename to src/test/resources/petstore-1.1/pet.json diff --git a/src/test/resources/petstore/resources.json b/src/test/resources/petstore-1.1/resources.json similarity index 100% rename from src/test/resources/petstore/resources.json rename to src/test/resources/petstore-1.1/resources.json diff --git a/src/test/resources/petstore/store.json b/src/test/resources/petstore-1.1/store.json similarity index 100% rename from src/test/resources/petstore/store.json rename to src/test/resources/petstore-1.1/store.json diff --git a/src/test/resources/petstore/user.json b/src/test/resources/petstore-1.1/user.json similarity index 100% rename from src/test/resources/petstore/user.json rename to src/test/resources/petstore-1.1/user.json diff --git a/src/test/resources/petstore-1.2/api-docs b/src/test/resources/petstore-1.2/api-docs new file mode 100644 index 000000000000..e02c32290ad9 --- /dev/null +++ b/src/test/resources/petstore-1.2/api-docs @@ -0,0 +1,57 @@ +{ + "apiVersion": "1.0.0", + "swaggerVersion": "1.2", + "apis": [ + { + "path": "/pet", + "description": "Operations about pets" + }, + { + "path": "/user", + "description": "Operations about user" + }, + { + "path": "/store", + "description": "Operations about store" + } + ], + "authorizations": { + "oauth2": { + "type": "oauth2", + "scopes": [ + "PUBLIC" + ], + "grantTypes": { + "implicit": { + "loginEndpoint": { + "url": "http://localhost:8002/oauth/dialog" + }, + "tokenName": "access_code" + }, + "authorization_code": { + "tokenRequestEndpoint": { + "url": "http://localhost:8002/oauth/requestToken", + "clientIdName": "client_id", + "clientSecretName": "client_secret" + }, + "tokenEndpoint": { + "url": "http://localhost:8002/oauth/token", + "tokenName": "access_code" + } + } + } + }, + "apiKey": { + "type": "apiKey", + "passAs": "header" + } + }, + "info": { + "title": "Swagger Sample App", + "description": "This is a sample server Petstore server. You can find out more about Swagger \n at http://swagger.wordnik.com or on irc.freenode.net, #swagger.", + "termsOfServiceUrl": "http://helloreverb.com/terms/", + "contact": "apiteam@wordnik.com", + "license": "Apache 2.0", + "licenseUrl": "http://www.apache.org/licenses/LICENSE-2.0.html" + } +} \ No newline at end of file diff --git a/src/test/resources/petstore-1.2/pet b/src/test/resources/petstore-1.2/pet new file mode 100644 index 000000000000..d155b70faaf7 --- /dev/null +++ b/src/test/resources/petstore-1.2/pet @@ -0,0 +1,284 @@ +{ + "apiVersion": "1.0.0", + "swaggerVersion": "1.2", + "basePath": "http://petstore.swagger.wordnik.com/api", + "resourcePath": "/pet", + "produces": [ + "application/json", + "application/xml", + "text/plain", + "text/html" + ], + "apis": [ + { + "path": "/pet/{petId}", + "operations": [ + { + "method": "GET", + "summary": "Find pet by ID", + "notes": "Returns a pet based on ID", + "responseClass": "Pet", + "nickname": "getPetById", + "produces": [ + "application/json", + "application/xml" + ], + "authorizations": [ + "oauth2" + ], + "parameters": [ + { + "name": "petId", + "description": "ID of pet that needs to be fetched", + "required": true, + "allowMultiple": false, + "dataType": "string", + "paramType": "path" + } + ], + "responseMessages": [ + { + "code": 400, + "message": "Invalid ID supplied" + }, + { + "code": 404, + "message": "Pet not found" + } + ] + }, + { + "method": "DELETE", + "summary": "Deletes a pet", + "notes": "", + "responseClass": "void", + "nickname": "deletePet", + "parameters": [ + { + "name": "petId", + "description": "Pet id to delete", + "required": true, + "allowMultiple": false, + "dataType": "string", + "paramType": "path" + } + ], + "responseMessages": [ + { + "code": 400, + "message": "Invalid pet value" + } + ] + } + ] + }, + { + "path": "/pet", + "operations": [ + { + "method": "POST", + "summary": "Add a new pet to the store", + "notes": "", + "responseClass": "void", + "nickname": "addPet", + "parameters": [ + { + "name": "body", + "description": "Pet object that needs to be added to the store", + "required": true, + "allowMultiple": false, + "dataType": "Pet", + "paramType": "body" + } + ], + "responseMessages": [ + { + "code": 405, + "message": "Invalid input" + } + ] + }, + { + "method": "PUT", + "summary": "Update an existing pet", + "notes": "", + "responseClass": "void", + "nickname": "updatePet", + "parameters": [ + { + "name": "body", + "description": "Pet object that needs to be updated in the store", + "required": true, + "allowMultiple": false, + "dataType": "Pet", + "paramType": "body" + } + ], + "responseMessages": [ + { + "code": 400, + "message": "Invalid ID supplied" + }, + { + "code": 404, + "message": "Pet not found" + }, + { + "code": 405, + "message": "Validation exception" + } + ] + } + ] + }, + { + "path": "/pet/findByStatus", + "operations": [ + { + "method": "GET", + "summary": "Finds Pets by status", + "notes": "Multiple status values can be provided with comma seperated strings", + "responseClass": "List[Pet]", + "nickname": "findPetsByStatus", + "produces": [ + "application/json", + "application/xml" + ], + "parameters": [ + { + "name": "status", + "description": "Status values that need to be considered for filter", + "defaultValue": "available", + "required": true, + "allowMultiple": true, + "dataType": "string", + "allowableValues": { + "valueType": "LIST", + "values": [ + "available", + "pending", + "sold" + ] + }, + "paramType": "query" + } + ], + "responseMessages": [ + { + "code": 400, + "message": "Invalid status value" + } + ] + } + ] + }, + { + "path": "/pet/findByTags", + "operations": [ + { + "method": "GET", + "summary": "Finds Pets by tags", + "notes": "Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing.", + "responseClass": "List[Pet]", + "nickname": "findPetsByTags", + "produces": [ + "application/json", + "application/xml" + ], + "parameters": [ + { + "name": "tags", + "description": "Tags to filter by", + "required": true, + "allowMultiple": true, + "dataType": "string", + "paramType": "query" + } + ], + "responseMessages": [ + { + "code": 400, + "message": "Invalid tag value" + } + ], + "deprecated": "true" + } + ] + } + ], + "models": { + "Tag": { + "id": "Tag", + "name": "Tag", + "properties": { + "name": { + "type": "string", + "required": false + }, + "id": { + "type": "long", + "required": false + } + } + }, + "Pet": { + "id": "Pet", + "name": "Pet", + "properties": { + "id": { + "type": "long", + "required": false + }, + "name": { + "type": "string", + "required": false + }, + "tags": { + "type": "List", + "required": false, + "items": { + "$ref": "Tag" + } + }, + "photoUrls": { + "type": "List", + "required": false, + "items": { + "type": "string" + } + }, + "status": { + "type": "string", + "required": false, + "description": "pet status in the store", + "allowableValues": { + "valueType": "LIST", + "values": [ + "available", + "pending", + "sold" + ] + } + }, + "category": { + "type": "Category", + "required": false + } + } + }, + "Category": { + "id": "Category", + "name": "Category", + "properties": { + "name": { + "type": "string", + "required": false + }, + "id": { + "type": "long", + "required": false + } + } + } + } +} \ No newline at end of file diff --git a/src/test/resources/petstore-1.2/store b/src/test/resources/petstore-1.2/store new file mode 100644 index 000000000000..baff3c3e421d --- /dev/null +++ b/src/test/resources/petstore-1.2/store @@ -0,0 +1,140 @@ +{ + "apiVersion": "1.0.0", + "swaggerVersion": "1.2", + "basePath": "http://petstore.swagger.wordnik.com/api", + "resourcePath": "/store", + "produces": [ + "application/json", + "application/xml" + ], + "apis": [ + { + "path": "/store/order/{orderId}", + "operations": [ + { + "method": "GET", + "summary": "Find purchase order by ID", + "notes": "For valid response try integer IDs with value <= 5. Anything above 5 or nonintegers will generate API errors", + "responseClass": "Order", + "nickname": "getOrderById", + "produces": [ + "application/json", + "application/xml" + ], + "parameters": [ + { + "name": "orderId", + "description": "ID of pet that needs to be fetched", + "required": true, + "allowMultiple": false, + "dataType": "string", + "paramType": "path" + } + ], + "responseMessages": [ + { + "code": 400, + "message": "Invalid ID supplied" + }, + { + "code": 404, + "message": "Order not found" + } + ] + }, + { + "method": "DELETE", + "summary": "Delete purchase order by ID", + "notes": "For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors", + "responseClass": "void", + "nickname": "deleteOrder", + "parameters": [ + { + "name": "orderId", + "description": "ID of the order that needs to be deleted", + "required": true, + "allowMultiple": false, + "dataType": "string", + "paramType": "path" + } + ], + "responseMessages": [ + { + "code": 400, + "message": "Invalid ID supplied" + }, + { + "code": 404, + "message": "Order not found" + } + ] + } + ] + }, + { + "path": "/store/order", + "operations": [ + { + "method": "POST", + "summary": "Place an order for a pet", + "notes": "", + "responseClass": "void", + "nickname": "placeOrder", + "parameters": [ + { + "name": "body", + "description": "order placed for purchasing the pet", + "required": true, + "allowMultiple": false, + "dataType": "Order", + "paramType": "body" + } + ], + "responseMessages": [ + { + "code": 400, + "message": "Invalid order" + } + ] + } + ] + } + ], + "models": { + "Order": { + "id": "Order", + "name": "Order", + "properties": { + "shipDate": { + "type": "Date", + "required": false + }, + "quantity": { + "type": "int", + "required": false + }, + "petId": { + "type": "long", + "required": false + }, + "id": { + "type": "long", + "required": false + }, + "status": { + "type": "string", + "required": false, + "description": "Order Status", + "allowableValues": { + "valueType": "LIST", + "values": [ + "placed", + "approved", + "delivered" + ] + } + } + } + } + } +} \ No newline at end of file diff --git a/src/test/resources/petstore-1.2/user b/src/test/resources/petstore-1.2/user new file mode 100644 index 000000000000..622aceeb5ef8 --- /dev/null +++ b/src/test/resources/petstore-1.2/user @@ -0,0 +1,280 @@ +{ + "apiVersion": "1.0.0", + "swaggerVersion": "1.2", + "basePath": "http://petstore.swagger.wordnik.com/api", + "resourcePath": "/user", + "produces": [ + "application/json", + "application/xml" + ], + "apis": [ + { + "path": "/user", + "operations": [ + { + "method": "POST", + "summary": "Create user", + "notes": "This can only be done by the logged in user.", + "responseClass": "void", + "nickname": "createUser", + "parameters": [ + { + "name": "body", + "description": "Created user object", + "required": true, + "allowMultiple": false, + "dataType": "User", + "paramType": "body" + } + ] + } + ] + }, + { + "path": "/user/createWithArray", + "operations": [ + { + "method": "POST", + "summary": "Creates list of users with given input array", + "notes": "", + "responseClass": "void", + "nickname": "createUsersWithArrayInput", + "parameters": [ + { + "name": "body", + "description": "List of user object", + "required": true, + "allowMultiple": false, + "dataType": "Array[User]", + "paramType": "body" + } + ] + } + ] + }, + { + "path": "/user/createWithList", + "operations": [ + { + "method": "POST", + "summary": "Creates list of users with given list input", + "notes": "", + "responseClass": "void", + "nickname": "createUsersWithListInput", + "parameters": [ + { + "name": "body", + "description": "List of user object", + "required": true, + "allowMultiple": false, + "dataType": "List[User]", + "paramType": "body" + } + ] + } + ] + }, + { + "path": "/user/{username}", + "operations": [ + { + "method": "PUT", + "summary": "Updated user", + "notes": "This can only be done by the logged in user.", + "responseClass": "void", + "nickname": "updateUser", + "parameters": [ + { + "name": "username", + "description": "name that need to be deleted", + "required": true, + "allowMultiple": false, + "dataType": "string", + "paramType": "path" + }, + { + "name": "body", + "description": "Updated user object", + "required": true, + "allowMultiple": false, + "dataType": "User", + "paramType": "body" + } + ], + "responseMessages": [ + { + "code": 400, + "message": "Invalid username supplied" + }, + { + "code": 404, + "message": "User not found" + } + ] + }, + { + "method": "DELETE", + "summary": "Delete user", + "notes": "This can only be done by the logged in user.", + "responseClass": "void", + "nickname": "deleteUser", + "parameters": [ + { + "name": "username", + "description": "The name that needs to be deleted", + "required": true, + "allowMultiple": false, + "dataType": "string", + "paramType": "path" + } + ], + "responseMessages": [ + { + "code": 400, + "message": "Invalid username supplied" + }, + { + "code": 404, + "message": "User not found" + } + ] + }, + { + "method": "GET", + "summary": "Get user by user name", + "notes": "", + "responseClass": "User", + "nickname": "getUserByName", + "produces": [ + "application/json", + "application/xml" + ], + "parameters": [ + { + "name": "username", + "description": "The name that needs to be fetched. Use user1 for testing.", + "required": true, + "allowMultiple": false, + "dataType": "string", + "paramType": "path" + } + ], + "responseMessages": [ + { + "code": 400, + "message": "Invalid username supplied" + }, + { + "code": 404, + "message": "User not found" + } + ] + } + ] + }, + { + "path": "/user/login", + "operations": [ + { + "method": "GET", + "summary": "Logs user into the system", + "notes": "", + "responseClass": "string", + "nickname": "loginUser", + "produces": [ + "text/plain" + ], + "parameters": [ + { + "name": "username", + "description": "The user name for login", + "required": true, + "allowMultiple": false, + "dataType": "string", + "paramType": "query" + }, + { + "name": "password", + "description": "The password for login in clear text", + "required": true, + "allowMultiple": false, + "dataType": "string", + "paramType": "query" + } + ], + "responseMessages": [ + { + "code": 400, + "message": "Invalid username and password combination" + } + ] + } + ] + }, + { + "path": "/user/logout", + "operations": [ + { + "method": "GET", + "summary": "Logs out current logged in user session", + "notes": "", + "responseClass": "void", + "nickname": "logoutUser", + "produces": [ + "text/plain" + ], + "parameters": [] + } + ] + } + ], + "models": { + "User": { + "id": "User", + "name": "User", + "properties": { + "email": { + "type": "string", + "required": false + }, + "username": { + "type": "string", + "required": false + }, + "userStatus": { + "type": "int", + "required": false, + "description": "User Status", + "allowableValues": { + "valueType": "LIST", + "values": [ + "1-registered", + "2-active", + "3-closed" + ] + } + }, + "lastName": { + "type": "string", + "required": false + }, + "firstName": { + "type": "string", + "required": false + }, + "id": { + "type": "long", + "required": false + }, + "phone": { + "type": "string", + "required": false + }, + "password": { + "type": "string", + "required": false + } + } + } + } +} \ No newline at end of file