From cb55d38a38fda6de7c4883a3c8a67ce6fa6ef33f Mon Sep 17 00:00:00 2001 From: Tony Tam Date: Tue, 28 Aug 2012 16:31:24 -0700 Subject: [PATCH] formatting --- src/test/resources/petstore/pet.json | 230 ++++++++++++++++++- src/test/resources/petstore/resources.json | 20 +- src/test/resources/petstore/store.json | 128 ++++++++++- src/test/resources/petstore/user.json | 255 ++++++++++++++++++++- 4 files changed, 629 insertions(+), 4 deletions(-) diff --git a/src/test/resources/petstore/pet.json b/src/test/resources/petstore/pet.json index 9a56191345f..fb71108cee8 100644 --- a/src/test/resources/petstore/pet.json +++ b/src/test/resources/petstore/pet.json @@ -1 +1,229 @@ -{"apiVersion":"0.2","swaggerVersion":"1.1","basePath":"http://petstore.swagger.wordnik.com/api","resourcePath":"/pet","apis":[{"path":"/pet.{format}/{petId}","description":"Operations about pets","operations":[{"httpMethod":"GET","summary":"Find pet by ID","notes":"Returns a pet based on ID","responseClass":"Pet","nickname":"getPetById","parameters":[{"name":"petId","description":"ID of pet that needs to be fetched","paramType":"path","required":true,"allowMultiple":false,"dataType":"string"}],"errorResponses":[{"code":400,"reason":"Invalid ID supplied"},{"code":404,"reason":"Pet not found"}]}]},{"path":"/pet.{format}","description":"Operations about pets","operations":[{"httpMethod":"POST","summary":"Add a new pet to the store","responseClass":"void","nickname":"addPet","parameters":[{"description":"Pet object that needs to be added to the store","paramType":"body","required":true,"allowMultiple":false,"dataType":"Pet"}],"errorResponses":[{"code":405,"reason":"Invalid input"}]},{"httpMethod":"PUT","summary":"Update an existing pet","responseClass":"void","nickname":"updatePet","parameters":[{"description":"Pet object that needs to be updated in the store","paramType":"body","required":true,"allowMultiple":false,"dataType":"Pet"}],"errorResponses":[{"code":400,"reason":"Invalid ID supplied"},{"code":404,"reason":"Pet not found"},{"code":405,"reason":"Validation exception"}]}]},{"path":"/pet.{format}/findByStatus","description":"Operations about pets","operations":[{"httpMethod":"GET","summary":"Finds Pets by status","notes":"Multiple status values can be provided with comma seperated strings","responseClass":"List[Pet]","nickname":"findPetsByStatus","parameters":[{"name":"status","description":"Status values that need to be considered for filter","paramType":"query","defaultValue":"available","allowableValues":{"valueType":"LIST","values":["available","pending","sold"],"valueType":"LIST"},"required":true,"allowMultiple":true,"dataType":"string"}],"errorResponses":[{"code":400,"reason":"Invalid status value"}]}]},{"path":"/pet.{format}/findByTags","description":"Operations about pets","operations":[{"httpMethod":"GET","summary":"Finds Pets by tags","notes":"Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing.","deprecated":true,"responseClass":"List[Pet]","nickname":"findPetsByTags","parameters":[{"name":"tags","description":"Tags to filter by","paramType":"query","required":true,"allowMultiple":true,"dataType":"string"}],"errorResponses":[{"code":400,"reason":"Invalid tag value"}]}]}],"models":{"Category":{"id":"Category","properties":{"id":{"type":"long"},"name":{"type":"string"}}},"Pet":{"id":"Pet","properties":{"tags":{"items":{"$ref":"Tag"},"type":"Array"},"id":{"type":"long"},"category":{"type":"Category"},"status":{"allowableValues":{"valueType":"LIST","values":["available","pending","sold"],"valueType":"LIST"},"description":"pet status in the store","type":"string"},"name":{"type":"string"},"photoUrls":{"items":{"type":"string"},"type":"Array"}}},"Tag":{"id":"Tag","properties":{"id":{"type":"long"},"name":{"type":"string"}}}}} \ No newline at end of file +{ + "apiVersion":"0.2", + "swaggerVersion":"1.1", + "basePath":"http://petstore.swagger.wordnik.com/api", + "resourcePath":"/pet", + "apis":[ + { + "path":"/pet.{format}/{petId}", + "description":"Operations about pets", + "operations":[ + { + "httpMethod":"GET", + "summary":"Find pet by ID", + "notes":"Returns a pet based on ID", + "responseClass":"Pet", + "nickname":"getPetById", + "parameters":[ + { + "name":"petId", + "description":"ID of pet that needs to be fetched", + "paramType":"path", + "required":true, + "allowMultiple":false, + "dataType":"string" + } + ], + "errorResponses":[ + { + "code":400, + "reason":"Invalid ID supplied" + }, + { + "code":404, + "reason":"Pet not found" + } + ] + } + ] + }, + { + "path":"/pet.{format}", + "description":"Operations about pets", + "operations":[ + { + "httpMethod":"POST", + "summary":"Add a new pet to the store", + "responseClass":"void", + "nickname":"addPet", + "parameters":[ + { + "description":"Pet object that needs to be added to the store", + "paramType":"body", + "required":true, + "allowMultiple":false, + "dataType":"Pet" + } + ], + "errorResponses":[ + { + "code":405, + "reason":"Invalid input" + } + ] + }, + { + "httpMethod":"PUT", + "summary":"Update an existing pet", + "responseClass":"void", + "nickname":"updatePet", + "parameters":[ + { + "description":"Pet object that needs to be updated in the store", + "paramType":"body", + "required":true, + "allowMultiple":false, + "dataType":"Pet" + } + ], + "errorResponses":[ + { + "code":400, + "reason":"Invalid ID supplied" + }, + { + "code":404, + "reason":"Pet not found" + }, + { + "code":405, + "reason":"Validation exception" + } + ] + } + ] + }, + { + "path":"/pet.{format}/findByStatus", + "description":"Operations about pets", + "operations":[ + { + "httpMethod":"GET", + "summary":"Finds Pets by status", + "notes":"Multiple status values can be provided with comma seperated strings", + "responseClass":"List[Pet]", + "nickname":"findPetsByStatus", + "parameters":[ + { + "name":"status", + "description":"Status values that need to be considered for filter", + "paramType":"query", + "defaultValue":"available", + "allowableValues":{ + "valueType":"LIST", + "values":[ + "available", + "pending", + "sold" + ], + "valueType":"LIST" + }, + "required":true, + "allowMultiple":true, + "dataType":"string" + } + ], + "errorResponses":[ + { + "code":400, + "reason":"Invalid status value" + } + ] + } + ] + }, + { + "path":"/pet.{format}/findByTags", + "description":"Operations about pets", + "operations":[ + { + "httpMethod":"GET", + "summary":"Finds Pets by tags", + "notes":"Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing.", + "deprecated":true, + "responseClass":"List[Pet]", + "nickname":"findPetsByTags", + "parameters":[ + { + "name":"tags", + "description":"Tags to filter by", + "paramType":"query", + "required":true, + "allowMultiple":true, + "dataType":"string" + } + ], + "errorResponses":[ + { + "code":400, + "reason":"Invalid tag value" + } + ] + } + ] + } + ], + "models":{ + "Category":{ + "id":"Category", + "properties":{ + "id":{ + "type":"long" + }, + "name":{ + "type":"string" + } + } + }, + "Pet":{ + "id":"Pet", + "properties":{ + "tags":{ + "items":{ + "$ref":"Tag" + }, + "type":"Array" + }, + "id":{ + "type":"long" + }, + "category":{ + "type":"Category" + }, + "status":{ + "allowableValues":{ + "valueType":"LIST", + "values":[ + "available", + "pending", + "sold" + ], + "valueType":"LIST" + }, + "description":"pet status in the store", + "type":"string" + }, + "name":{ + "type":"string" + }, + "photoUrls":{ + "items":{ + "type":"string" + }, + "type":"Array" + } + } + }, + "Tag":{ + "id":"Tag", + "properties":{ + "id":{ + "type":"long" + }, + "name":{ + "type":"string" + } + } + } + } +} \ No newline at end of file diff --git a/src/test/resources/petstore/resources.json b/src/test/resources/petstore/resources.json index 7428f718868..977096ab5b8 100644 --- a/src/test/resources/petstore/resources.json +++ b/src/test/resources/petstore/resources.json @@ -1 +1,19 @@ -{"apiVersion":"0.2","swaggerVersion":"1.1","basePath":"http://petstore.swagger.wordnik.com/api","apis":[{"path":"/store.{format}","description":"Operations about store"},{"path":"/pet.{format}","description":"Operations about pets"},{"path":"/user.{format}","description":"Operations about user"}]} \ No newline at end of file +{ + "apiVersion":"0.2", + "swaggerVersion":"1.1", + "basePath":"http://petstore.swagger.wordnik.com/api", + "apis":[ + { + "path":"/store.{format}", + "description":"Operations about store" + }, + { + "path":"/pet.{format}", + "description":"Operations about pets" + }, + { + "path":"/user.{format}", + "description":"Operations about user" + } + ] +} \ No newline at end of file diff --git a/src/test/resources/petstore/store.json b/src/test/resources/petstore/store.json index ad85d33fef3..0c31f64c10c 100644 --- a/src/test/resources/petstore/store.json +++ b/src/test/resources/petstore/store.json @@ -1 +1,127 @@ -{"apiVersion":"0.2","swaggerVersion":"1.1","basePath":"http://petstore.swagger.wordnik.com/api","resourcePath":"/store","apis":[{"path":"/store.{format}/order/{orderId}","description":"Operations about store","operations":[{"httpMethod":"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","parameters":[{"name":"orderId","description":"ID of pet that needs to be fetched","paramType":"path","required":true,"allowMultiple":false,"dataType":"string"}],"errorResponses":[{"code":400,"reason":"Invalid ID supplied"},{"code":404,"reason":"Order not found"}]},{"httpMethod":"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","paramType":"path","required":true,"allowMultiple":false,"dataType":"string"}],"errorResponses":[{"code":400,"reason":"Invalid ID supplied"},{"code":404,"reason":"Order not found"}]}]},{"path":"/store.{format}/order","description":"Operations about store","operations":[{"httpMethod":"POST","summary":"Place an order for a pet","responseClass":"void","nickname":"placeOrder","parameters":[{"description":"order placed for purchasing the pet","paramType":"body","required":true,"allowMultiple":false,"dataType":"Order"}],"errorResponses":[{"code":400,"reason":"Invalid order"}]}]}],"models":{"Order":{"id":"Order","properties":{"id":{"type":"long"},"petId":{"type":"long"},"status":{"allowableValues":{"valueType":"LIST","values":["placed"," approved"," delivered"],"valueType":"LIST"},"description":"Order Status","type":"string"},"quantity":{"type":"int"},"shipDate":{"type":"Date"}}}}} \ No newline at end of file +{ + "apiVersion":"0.2", + "swaggerVersion":"1.1", + "basePath":"http://petstore.swagger.wordnik.com/api", + "resourcePath":"/store", + "apis":[ + { + "path":"/store.{format}/order/{orderId}", + "description":"Operations about store", + "operations":[ + { + "httpMethod":"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", + "parameters":[ + { + "name":"orderId", + "description":"ID of pet that needs to be fetched", + "paramType":"path", + "required":true, + "allowMultiple":false, + "dataType":"string" + } + ], + "errorResponses":[ + { + "code":400, + "reason":"Invalid ID supplied" + }, + { + "code":404, + "reason":"Order not found" + } + ] + }, + { + "httpMethod":"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", + "paramType":"path", + "required":true, + "allowMultiple":false, + "dataType":"string" + } + ], + "errorResponses":[ + { + "code":400, + "reason":"Invalid ID supplied" + }, + { + "code":404, + "reason":"Order not found" + } + ] + } + ] + }, + { + "path":"/store.{format}/order", + "description":"Operations about store", + "operations":[ + { + "httpMethod":"POST", + "summary":"Place an order for a pet", + "responseClass":"void", + "nickname":"placeOrder", + "parameters":[ + { + "description":"order placed for purchasing the pet", + "paramType":"body", + "required":true, + "allowMultiple":false, + "dataType":"Order" + } + ], + "errorResponses":[ + { + "code":400, + "reason":"Invalid order" + } + ] + } + ] + } + ], + "models":{ + "Order":{ + "id":"Order", + "properties":{ + "id":{ + "type":"long" + }, + "petId":{ + "type":"long" + }, + "status":{ + "allowableValues":{ + "valueType":"LIST", + "values":[ + "placed", + " approved", + " delivered" + ], + "valueType":"LIST" + }, + "description":"Order Status", + "type":"string" + }, + "quantity":{ + "type":"int" + }, + "shipDate":{ + "type":"Date" + } + } + } + } +} \ No newline at end of file diff --git a/src/test/resources/petstore/user.json b/src/test/resources/petstore/user.json index b90b18d1bbe..221f58ded74 100644 --- a/src/test/resources/petstore/user.json +++ b/src/test/resources/petstore/user.json @@ -1 +1,254 @@ -{"apiVersion":"0.2","swaggerVersion":"1.1","basePath":"http://petstore.swagger.wordnik.com/api","resourcePath":"/user","apis":[{"path":"/user.{format}/createWithArray","description":"Operations about user","operations":[{"httpMethod":"POST","summary":"Creates list of users with given input array","responseClass":"void","nickname":"createUsersWithArrayInput","parameters":[{"description":"List of user object","paramType":"body","required":true,"allowMultiple":false,"dataType":"Array[User]"}]}]},{"path":"/user.{format}","description":"Operations about user","operations":[{"httpMethod":"POST","summary":"Create user","notes":"This can only be done by the logged in user.","responseClass":"void","nickname":"createUser","parameters":[{"description":"Created user object","paramType":"body","required":true,"allowMultiple":false,"dataType":"User"}]}]},{"path":"/user.{format}/createWithList","description":"Operations about user","operations":[{"httpMethod":"POST","summary":"Creates list of users with given list input","responseClass":"void","nickname":"createUsersWithListInput","parameters":[{"description":"List of user object","paramType":"body","required":true,"allowMultiple":false,"dataType":"List[User]"}]}]},{"path":"/user.{format}/{username}","description":"Operations about user","operations":[{"httpMethod":"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","paramType":"path","required":true,"allowMultiple":false,"dataType":"string"},{"description":"Updated user object","paramType":"body","required":true,"allowMultiple":false,"dataType":"User"}],"errorResponses":[{"code":400,"reason":"Invalid username supplied"},{"code":404,"reason":"User not found"}]},{"httpMethod":"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","paramType":"path","required":true,"allowMultiple":false,"dataType":"string"}],"errorResponses":[{"code":400,"reason":"Invalid username supplied"},{"code":404,"reason":"User not found"}]},{"httpMethod":"GET","summary":"Get user by user name","responseClass":"User","nickname":"getUserByName","parameters":[{"name":"username","description":"The name that needs to be fetched. Use user1 for testing.","paramType":"path","required":true,"allowMultiple":false,"dataType":"string"}],"errorResponses":[{"code":400,"reason":"Invalid username supplied"},{"code":404,"reason":"User not found"}]}]},{"path":"/user.{format}/login","description":"Operations about user","operations":[{"httpMethod":"GET","summary":"Logs user into the system","responseClass":"string","nickname":"loginUser","parameters":[{"name":"username","description":"The user name for login","paramType":"query","required":true,"allowMultiple":false,"dataType":"string"},{"name":"password","description":"The password for login in clear text","paramType":"query","required":true,"allowMultiple":false,"dataType":"string"}],"errorResponses":[{"code":400,"reason":"Invalid username and password combination"}]}]},{"path":"/user.{format}/logout","description":"Operations about user","operations":[{"httpMethod":"GET","summary":"Logs out current logged in user session","responseClass":"void","nickname":"logoutUser"}]}],"models":{"User":{"id":"User","properties":{"id":{"type":"Long"},"lastName":{"type":"string"},"phone":{"type":"string"},"username":{"type":"string"},"email":{"type":"string"},"userStatus":{"allowableValues":{"valueType":"LIST","values":["1-registered","2-active","3-closed"],"valueType":"LIST"},"description":"User Status","type":"int"},"firstName":{"type":"string"},"password":{"type":"string"}}}}} \ No newline at end of file +{ + "apiVersion":"0.2", + "swaggerVersion":"1.1", + "basePath":"http://petstore.swagger.wordnik.com/api", + "resourcePath":"/user", + "apis":[ + { + "path":"/user.{format}/createWithArray", + "description":"Operations about user", + "operations":[ + { + "httpMethod":"POST", + "summary":"Creates list of users with given input array", + "responseClass":"void", + "nickname":"createUsersWithArrayInput", + "parameters":[ + { + "description":"List of user object", + "paramType":"body", + "required":true, + "allowMultiple":false, + "dataType":"Array[User]" + } + ] + } + ] + }, + { + "path":"/user.{format}", + "description":"Operations about user", + "operations":[ + { + "httpMethod":"POST", + "summary":"Create user", + "notes":"This can only be done by the logged in user.", + "responseClass":"void", + "nickname":"createUser", + "parameters":[ + { + "description":"Created user object", + "paramType":"body", + "required":true, + "allowMultiple":false, + "dataType":"User" + } + ] + } + ] + }, + { + "path":"/user.{format}/createWithList", + "description":"Operations about user", + "operations":[ + { + "httpMethod":"POST", + "summary":"Creates list of users with given list input", + "responseClass":"void", + "nickname":"createUsersWithListInput", + "parameters":[ + { + "description":"List of user object", + "paramType":"body", + "required":true, + "allowMultiple":false, + "dataType":"List[User]" + } + ] + } + ] + }, + { + "path":"/user.{format}/{username}", + "description":"Operations about user", + "operations":[ + { + "httpMethod":"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", + "paramType":"path", + "required":true, + "allowMultiple":false, + "dataType":"string" + }, + { + "description":"Updated user object", + "paramType":"body", + "required":true, + "allowMultiple":false, + "dataType":"User" + } + ], + "errorResponses":[ + { + "code":400, + "reason":"Invalid username supplied" + }, + { + "code":404, + "reason":"User not found" + } + ] + }, + { + "httpMethod":"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", + "paramType":"path", + "required":true, + "allowMultiple":false, + "dataType":"string" + } + ], + "errorResponses":[ + { + "code":400, + "reason":"Invalid username supplied" + }, + { + "code":404, + "reason":"User not found" + } + ] + }, + { + "httpMethod":"GET", + "summary":"Get user by user name", + "responseClass":"User", + "nickname":"getUserByName", + "parameters":[ + { + "name":"username", + "description":"The name that needs to be fetched. Use user1 for testing.", + "paramType":"path", + "required":true, + "allowMultiple":false, + "dataType":"string" + } + ], + "errorResponses":[ + { + "code":400, + "reason":"Invalid username supplied" + }, + { + "code":404, + "reason":"User not found" + } + ] + } + ] + }, + { + "path":"/user.{format}/login", + "description":"Operations about user", + "operations":[ + { + "httpMethod":"GET", + "summary":"Logs user into the system", + "responseClass":"string", + "nickname":"loginUser", + "parameters":[ + { + "name":"username", + "description":"The user name for login", + "paramType":"query", + "required":true, + "allowMultiple":false, + "dataType":"string" + }, + { + "name":"password", + "description":"The password for login in clear text", + "paramType":"query", + "required":true, + "allowMultiple":false, + "dataType":"string" + } + ], + "errorResponses":[ + { + "code":400, + "reason":"Invalid username and password combination" + } + ] + } + ] + }, + { + "path":"/user.{format}/logout", + "description":"Operations about user", + "operations":[ + { + "httpMethod":"GET", + "summary":"Logs out current logged in user session", + "responseClass":"void", + "nickname":"logoutUser" + } + ] + } + ], + "models":{ + "User":{ + "id":"User", + "properties":{ + "id":{ + "type":"Long" + }, + "lastName":{ + "type":"string" + }, + "phone":{ + "type":"string" + }, + "username":{ + "type":"string" + }, + "email":{ + "type":"string" + }, + "userStatus":{ + "allowableValues":{ + "valueType":"LIST", + "values":[ + "1-registered", + "2-active", + "3-closed" + ], + "valueType":"LIST" + }, + "description":"User Status", + "type":"int" + }, + "firstName":{ + "type":"string" + }, + "password":{ + "type":"string" + } + } + } + } +} \ No newline at end of file