forked from loafle/openapi-generator-original
make slim sh executable
This commit is contained in:
parent
83a4556803
commit
93cadcd755
0
bin/slim-petstore-server.sh
Normal file → Executable file
0
bin/slim-petstore-server.sh
Normal file → Executable file
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
## Overview
|
## Overview
|
||||||
This server was generated by the [swagger-codegen](https://github.com/swagger-api/swagger-codegen) project. By using the
|
This server was generated by the [swagger-codegen](https://github.com/swagger-api/swagger-codegen) project. By using the
|
||||||
[swagger-spec](https://github.com/swagger-api/swagger-core/wiki) from a remote server, you can easily generate a server stub. This
|
[OpenAPI-Spec](https://github.com/swagger-api/swagger-core/wiki) from a remote server, you can easily generate a server stub. This
|
||||||
is an example of building a PHP server.
|
is an example of building a PHP server.
|
||||||
|
|
||||||
This example uses the [Slim Framework](http://www.slimframework.com/). To see how to make this your own, please take a look at the template here:
|
This example uses the [Slim Framework](http://www.slimframework.com/). To see how to make this your own, please take a look at the template here:
|
||||||
|
@ -13,7 +13,7 @@ $app = new Slim\App();
|
|||||||
* POST createUser
|
* POST createUser
|
||||||
* Summary: Create user
|
* Summary: Create user
|
||||||
* Notes: This can only be done by the logged in user.
|
* Notes: This can only be done by the logged in user.
|
||||||
* Output-Formats: [application/xml, application/json]
|
* Output-Formats: [application/json, application/xml]
|
||||||
*/
|
*/
|
||||||
$app->POST('/user', function($request, $response, $args) {
|
$app->POST('/user', function($request, $response, $args) {
|
||||||
|
|
||||||
@ -29,7 +29,7 @@ $app->POST('/user', function($request, $response, $args) {
|
|||||||
* POST createUsersWithArrayInput
|
* POST createUsersWithArrayInput
|
||||||
* Summary: Creates list of users with given input array
|
* Summary: Creates list of users with given input array
|
||||||
* Notes:
|
* Notes:
|
||||||
* Output-Formats: [application/xml, application/json]
|
* Output-Formats: [application/json, application/xml]
|
||||||
*/
|
*/
|
||||||
$app->POST('/user/createWithArray', function($request, $response, $args) {
|
$app->POST('/user/createWithArray', function($request, $response, $args) {
|
||||||
|
|
||||||
@ -45,7 +45,7 @@ $app->POST('/user/createWithArray', function($request, $response, $args) {
|
|||||||
* POST createUsersWithListInput
|
* POST createUsersWithListInput
|
||||||
* Summary: Creates list of users with given input array
|
* Summary: Creates list of users with given input array
|
||||||
* Notes:
|
* Notes:
|
||||||
* Output-Formats: [application/xml, application/json]
|
* Output-Formats: [application/json, application/xml]
|
||||||
*/
|
*/
|
||||||
$app->POST('/user/createWithList', function($request, $response, $args) {
|
$app->POST('/user/createWithList', function($request, $response, $args) {
|
||||||
|
|
||||||
@ -61,7 +61,7 @@ $app->POST('/user/createWithList', function($request, $response, $args) {
|
|||||||
* GET loginUser
|
* GET loginUser
|
||||||
* Summary: Logs user into the system
|
* Summary: Logs user into the system
|
||||||
* Notes:
|
* Notes:
|
||||||
* Output-Formats: [application/xml, application/json]
|
* Output-Formats: [application/json, application/xml]
|
||||||
*/
|
*/
|
||||||
$app->GET('/user/login', function($request, $response, $args) {
|
$app->GET('/user/login', function($request, $response, $args) {
|
||||||
|
|
||||||
@ -78,7 +78,7 @@ $app->GET('/user/login', function($request, $response, $args) {
|
|||||||
* GET logoutUser
|
* GET logoutUser
|
||||||
* Summary: Logs out current logged in user session
|
* Summary: Logs out current logged in user session
|
||||||
* Notes:
|
* Notes:
|
||||||
* Output-Formats: [application/xml, application/json]
|
* Output-Formats: [application/json, application/xml]
|
||||||
*/
|
*/
|
||||||
$app->GET('/user/logout', function($request, $response, $args) {
|
$app->GET('/user/logout', function($request, $response, $args) {
|
||||||
|
|
||||||
@ -94,7 +94,7 @@ $app->GET('/user/logout', function($request, $response, $args) {
|
|||||||
* GET getUserByName
|
* GET getUserByName
|
||||||
* Summary: Get user by user name
|
* Summary: Get user by user name
|
||||||
* Notes:
|
* Notes:
|
||||||
* Output-Formats: [application/xml, application/json]
|
* Output-Formats: [application/json, application/xml]
|
||||||
*/
|
*/
|
||||||
$app->GET('/user/{username}', function($request, $response, $args) {
|
$app->GET('/user/{username}', function($request, $response, $args) {
|
||||||
|
|
||||||
@ -110,7 +110,7 @@ $app->GET('/user/{username}', function($request, $response, $args) {
|
|||||||
* PUT updateUser
|
* PUT updateUser
|
||||||
* Summary: Updated user
|
* Summary: Updated user
|
||||||
* Notes: This can only be done by the logged in user.
|
* Notes: This can only be done by the logged in user.
|
||||||
* Output-Formats: [application/xml, application/json]
|
* Output-Formats: [application/json, application/xml]
|
||||||
*/
|
*/
|
||||||
$app->PUT('/user/{username}', function($request, $response, $args) {
|
$app->PUT('/user/{username}', function($request, $response, $args) {
|
||||||
|
|
||||||
@ -126,7 +126,7 @@ $app->PUT('/user/{username}', function($request, $response, $args) {
|
|||||||
* DELETE deleteUser
|
* DELETE deleteUser
|
||||||
* Summary: Delete user
|
* Summary: Delete user
|
||||||
* Notes: This can only be done by the logged in user.
|
* Notes: This can only be done by the logged in user.
|
||||||
* Output-Formats: [application/xml, application/json]
|
* Output-Formats: [application/json, application/xml]
|
||||||
*/
|
*/
|
||||||
$app->DELETE('/user/{username}', function($request, $response, $args) {
|
$app->DELETE('/user/{username}', function($request, $response, $args) {
|
||||||
|
|
||||||
@ -138,75 +138,11 @@ $app->DELETE('/user/{username}', function($request, $response, $args) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* GET getInventory
|
|
||||||
* Summary: Returns pet inventories by status
|
|
||||||
* Notes: Returns a map of status codes to quantities
|
|
||||||
* Output-Formats: [application/json]
|
|
||||||
*/
|
|
||||||
$app->GET('/store/inventory', function($request, $response, $args) {
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$response->write('How about implementing getInventory as a GET method ?');
|
|
||||||
return $response;
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* POST placeOrder
|
|
||||||
* Summary: Place an order for a pet
|
|
||||||
* Notes:
|
|
||||||
* Output-Formats: [application/xml, application/json]
|
|
||||||
*/
|
|
||||||
$app->POST('/store/order', function($request, $response, $args) {
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$body = $request->getParsedBody();
|
|
||||||
$response->write('How about implementing placeOrder as a POST method ?');
|
|
||||||
return $response;
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* GET getOrderById
|
|
||||||
* Summary: Find purchase order by ID
|
|
||||||
* Notes: For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
|
|
||||||
* Output-Formats: [application/xml, application/json]
|
|
||||||
*/
|
|
||||||
$app->GET('/store/order/{orderId}', function($request, $response, $args) {
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$response->write('How about implementing getOrderById as a GET method ?');
|
|
||||||
return $response;
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* DELETE deleteOrder
|
|
||||||
* 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
|
|
||||||
* Output-Formats: [application/xml, application/json]
|
|
||||||
*/
|
|
||||||
$app->DELETE('/store/order/{orderId}', function($request, $response, $args) {
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$response->write('How about implementing deleteOrder as a DELETE method ?');
|
|
||||||
return $response;
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PUT updatePet
|
* PUT updatePet
|
||||||
* Summary: Update an existing pet
|
* Summary: Update an existing pet
|
||||||
* Notes:
|
* Notes:
|
||||||
* Output-Formats: [application/xml, application/json]
|
* Output-Formats: [application/json, application/xml]
|
||||||
*/
|
*/
|
||||||
$app->PUT('/pet', function($request, $response, $args) {
|
$app->PUT('/pet', function($request, $response, $args) {
|
||||||
|
|
||||||
@ -222,7 +158,7 @@ $app->PUT('/pet', function($request, $response, $args) {
|
|||||||
* POST addPet
|
* POST addPet
|
||||||
* Summary: Add a new pet to the store
|
* Summary: Add a new pet to the store
|
||||||
* Notes:
|
* Notes:
|
||||||
* Output-Formats: [application/xml, application/json]
|
* Output-Formats: [application/json, application/xml]
|
||||||
*/
|
*/
|
||||||
$app->POST('/pet', function($request, $response, $args) {
|
$app->POST('/pet', function($request, $response, $args) {
|
||||||
|
|
||||||
@ -238,7 +174,7 @@ $app->POST('/pet', function($request, $response, $args) {
|
|||||||
* GET findPetsByStatus
|
* GET findPetsByStatus
|
||||||
* Summary: Finds Pets by status
|
* Summary: Finds Pets by status
|
||||||
* Notes: Multiple status values can be provided with comma seperated strings
|
* Notes: Multiple status values can be provided with comma seperated strings
|
||||||
* Output-Formats: [application/xml, application/json]
|
* Output-Formats: [application/json, application/xml]
|
||||||
*/
|
*/
|
||||||
$app->GET('/pet/findByStatus', function($request, $response, $args) {
|
$app->GET('/pet/findByStatus', function($request, $response, $args) {
|
||||||
|
|
||||||
@ -255,7 +191,7 @@ $app->GET('/pet/findByStatus', function($request, $response, $args) {
|
|||||||
* GET findPetsByTags
|
* GET findPetsByTags
|
||||||
* Summary: Finds Pets by tags
|
* Summary: Finds Pets by tags
|
||||||
* Notes: Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing.
|
* Notes: Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing.
|
||||||
* Output-Formats: [application/xml, application/json]
|
* Output-Formats: [application/json, application/xml]
|
||||||
*/
|
*/
|
||||||
$app->GET('/pet/findByTags', function($request, $response, $args) {
|
$app->GET('/pet/findByTags', function($request, $response, $args) {
|
||||||
|
|
||||||
@ -271,8 +207,8 @@ $app->GET('/pet/findByTags', function($request, $response, $args) {
|
|||||||
/**
|
/**
|
||||||
* GET getPetById
|
* GET getPetById
|
||||||
* Summary: Find pet by ID
|
* Summary: Find pet by ID
|
||||||
* Notes: Returns a single pet
|
* Notes: Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions
|
||||||
* Output-Formats: [application/xml, application/json]
|
* Output-Formats: [application/json, application/xml]
|
||||||
*/
|
*/
|
||||||
$app->GET('/pet/{petId}', function($request, $response, $args) {
|
$app->GET('/pet/{petId}', function($request, $response, $args) {
|
||||||
|
|
||||||
@ -288,7 +224,7 @@ $app->GET('/pet/{petId}', function($request, $response, $args) {
|
|||||||
* POST updatePetWithForm
|
* POST updatePetWithForm
|
||||||
* Summary: Updates a pet in the store with form data
|
* Summary: Updates a pet in the store with form data
|
||||||
* Notes:
|
* Notes:
|
||||||
* Output-Formats: [application/xml, application/json]
|
* Output-Formats: [application/json, application/xml]
|
||||||
*/
|
*/
|
||||||
$app->POST('/pet/{petId}', function($request, $response, $args) {
|
$app->POST('/pet/{petId}', function($request, $response, $args) {
|
||||||
|
|
||||||
@ -304,7 +240,7 @@ $app->POST('/pet/{petId}', function($request, $response, $args) {
|
|||||||
* DELETE deletePet
|
* DELETE deletePet
|
||||||
* Summary: Deletes a pet
|
* Summary: Deletes a pet
|
||||||
* Notes:
|
* Notes:
|
||||||
* Output-Formats: [application/xml, application/json]
|
* Output-Formats: [application/json, application/xml]
|
||||||
*/
|
*/
|
||||||
$app->DELETE('/pet/{petId}', function($request, $response, $args) {
|
$app->DELETE('/pet/{petId}', function($request, $response, $args) {
|
||||||
$headers = $request->getHeaders();
|
$headers = $request->getHeaders();
|
||||||
@ -320,7 +256,7 @@ $app->DELETE('/pet/{petId}', function($request, $response, $args) {
|
|||||||
* POST uploadFile
|
* POST uploadFile
|
||||||
* Summary: uploads an image
|
* Summary: uploads an image
|
||||||
* Notes:
|
* Notes:
|
||||||
* Output-Formats: [application/json]
|
* Output-Formats: [application/json, application/xml]
|
||||||
*/
|
*/
|
||||||
$app->POST('/pet/{petId}/uploadImage', function($request, $response, $args) {
|
$app->POST('/pet/{petId}/uploadImage', function($request, $response, $args) {
|
||||||
|
|
||||||
@ -332,5 +268,101 @@ $app->POST('/pet/{petId}/uploadImage', function($request, $response, $args) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GET getPetByIdWithByteArray
|
||||||
|
* Summary: Fake endpoint to test byte array return by 'Find pet by ID'
|
||||||
|
* Notes: Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions
|
||||||
|
* Output-Formats: [application/json, application/xml]
|
||||||
|
*/
|
||||||
|
$app->GET('/pet/{petId}?testing_byte_array=true', function($request, $response, $args) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$response->write('How about implementing getPetByIdWithByteArray as a GET method ?');
|
||||||
|
return $response;
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* POST addPetUsingByteArray
|
||||||
|
* Summary: Fake endpoint to test byte array in body parameter for adding a new pet to the store
|
||||||
|
* Notes:
|
||||||
|
* Output-Formats: [application/json, application/xml]
|
||||||
|
*/
|
||||||
|
$app->POST('/pet?testing_byte_array=true', function($request, $response, $args) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$body = $request->getParsedBody();
|
||||||
|
$response->write('How about implementing addPetUsingByteArray as a POST method ?');
|
||||||
|
return $response;
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GET getInventory
|
||||||
|
* Summary: Returns pet inventories by status
|
||||||
|
* Notes: Returns a map of status codes to quantities
|
||||||
|
* Output-Formats: [application/json, application/xml]
|
||||||
|
*/
|
||||||
|
$app->GET('/store/inventory', function($request, $response, $args) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$response->write('How about implementing getInventory as a GET method ?');
|
||||||
|
return $response;
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* POST placeOrder
|
||||||
|
* Summary: Place an order for a pet
|
||||||
|
* Notes:
|
||||||
|
* Output-Formats: [application/json, application/xml]
|
||||||
|
*/
|
||||||
|
$app->POST('/store/order', function($request, $response, $args) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$body = $request->getParsedBody();
|
||||||
|
$response->write('How about implementing placeOrder as a POST method ?');
|
||||||
|
return $response;
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GET getOrderById
|
||||||
|
* Summary: Find purchase order by ID
|
||||||
|
* Notes: For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
|
||||||
|
* Output-Formats: [application/json, application/xml]
|
||||||
|
*/
|
||||||
|
$app->GET('/store/order/{orderId}', function($request, $response, $args) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$response->write('How about implementing getOrderById as a GET method ?');
|
||||||
|
return $response;
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* DELETE deleteOrder
|
||||||
|
* 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
|
||||||
|
* Output-Formats: [application/json, application/xml]
|
||||||
|
*/
|
||||||
|
$app->DELETE('/store/order/{orderId}', function($request, $response, $args) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$response->write('How about implementing deleteOrder as a DELETE method ?');
|
||||||
|
return $response;
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$app->run();
|
$app->run();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user