add context path (#3425)

This commit is contained in:
abcsun 2016-07-20 19:06:14 +08:00 committed by wing328
parent 9c7710e695
commit bee6803bcb
3 changed files with 54 additions and 23 deletions

View File

@ -19,7 +19,7 @@ $app->get('/', function () use ($app) {
* Notes: {{notes}}
{{#hasProduces}} * Output-Formats: [{{#produces}}{{{mediaType}}}{{#hasMore}}, {{/hasMore}}{{/produces}}]{{/hasProduces}}
*/
$app->{{httpMethod}}('{{path}}', '{{classname}}@{{operationId}}');
$app->{{httpMethod}}('{{basePathWithoutHost}}{{path}}', '{{classname}}@{{operationId}}');
{{/operation}}
{{/operations}}
{{/apis}}

View File

@ -38,6 +38,30 @@ class FakeApi extends Controller
{
}
/**
* Operation testClientModel
*
* To test \"client\" model.
*
*
* @return Http response
*/
public function testClientModel()
{
$input = Request::all();
//path params validation
//not path params validation
if (!isset($input['body'])) {
throw new \InvalidArgumentException('Missing the required parameter $body when calling testClientModel');
}
$body = $input['body'];
return response('How about implementing testClientModel as a PATCH method ?');
}
/**
* Operation testEndpointParameters
*

View File

@ -33,158 +33,165 @@ $app->get('/', function () use ($app) {
return $app->version();
});
/**
* PATCH testClientModel
* Summary: To test \"client\" model
* Notes:
* Output-Formats: [application/json]
*/
$app->PATCH('/v2/fake', 'FakeApi@testClientModel');
/**
* POST testEndpointParameters
* Summary: Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
* Notes: Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
* Output-Formats: [application/xml; charset=utf-8, application/json; charset=utf-8]
*/
$app->POST('/fake', 'FakeApi@testEndpointParameters');
$app->POST('/v2/fake', 'FakeApi@testEndpointParameters');
/**
* GET testEnumQueryParameters
* Summary: To test enum query parameters
* Notes:
* Output-Formats: [application/json]
*/
$app->GET('/fake', 'FakeApi@testEnumQueryParameters');
$app->GET('/v2/fake', 'FakeApi@testEnumQueryParameters');
/**
* POST addPet
* Summary: Add a new pet to the store
* Notes:
* Output-Formats: [application/xml, application/json]
*/
$app->POST('/pet', 'PetApi@addPet');
$app->POST('/v2/pet', 'PetApi@addPet');
/**
* PUT updatePet
* Summary: Update an existing pet
* Notes:
* Output-Formats: [application/xml, application/json]
*/
$app->PUT('/pet', 'PetApi@updatePet');
$app->PUT('/v2/pet', 'PetApi@updatePet');
/**
* GET findPetsByStatus
* Summary: Finds Pets by status
* Notes: Multiple status values can be provided with comma separated strings
* Output-Formats: [application/xml, application/json]
*/
$app->GET('/pet/findByStatus', 'PetApi@findPetsByStatus');
$app->GET('/v2/pet/findByStatus', 'PetApi@findPetsByStatus');
/**
* GET findPetsByTags
* Summary: Finds Pets by tags
* Notes: Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
* Output-Formats: [application/xml, application/json]
*/
$app->GET('/pet/findByTags', 'PetApi@findPetsByTags');
$app->GET('/v2/pet/findByTags', 'PetApi@findPetsByTags');
/**
* DELETE deletePet
* Summary: Deletes a pet
* Notes:
* Output-Formats: [application/xml, application/json]
*/
$app->DELETE('/pet/{petId}', 'PetApi@deletePet');
$app->DELETE('/v2/pet/{petId}', 'PetApi@deletePet');
/**
* GET getPetById
* Summary: Find pet by ID
* Notes: Returns a single pet
* Output-Formats: [application/xml, application/json]
*/
$app->GET('/pet/{petId}', 'PetApi@getPetById');
$app->GET('/v2/pet/{petId}', 'PetApi@getPetById');
/**
* POST updatePetWithForm
* Summary: Updates a pet in the store with form data
* Notes:
* Output-Formats: [application/xml, application/json]
*/
$app->POST('/pet/{petId}', 'PetApi@updatePetWithForm');
$app->POST('/v2/pet/{petId}', 'PetApi@updatePetWithForm');
/**
* POST uploadFile
* Summary: uploads an image
* Notes:
* Output-Formats: [application/json]
*/
$app->POST('/pet/{petId}/uploadImage', 'PetApi@uploadFile');
$app->POST('/v2/pet/{petId}/uploadImage', 'PetApi@uploadFile');
/**
* 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', 'StoreApi@getInventory');
$app->GET('/v2/store/inventory', 'StoreApi@getInventory');
/**
* POST placeOrder
* Summary: Place an order for a pet
* Notes:
* Output-Formats: [application/xml, application/json]
*/
$app->POST('/store/order', 'StoreApi@placeOrder');
$app->POST('/v2/store/order', 'StoreApi@placeOrder');
/**
* 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}', 'StoreApi@deleteOrder');
$app->DELETE('/v2/store/order/{orderId}', 'StoreApi@deleteOrder');
/**
* 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}', 'StoreApi@getOrderById');
$app->GET('/v2/store/order/{orderId}', 'StoreApi@getOrderById');
/**
* POST createUser
* Summary: Create user
* Notes: This can only be done by the logged in user.
* Output-Formats: [application/xml, application/json]
*/
$app->POST('/user', 'UserApi@createUser');
$app->POST('/v2/user', 'UserApi@createUser');
/**
* POST createUsersWithArrayInput
* Summary: Creates list of users with given input array
* Notes:
* Output-Formats: [application/xml, application/json]
*/
$app->POST('/user/createWithArray', 'UserApi@createUsersWithArrayInput');
$app->POST('/v2/user/createWithArray', 'UserApi@createUsersWithArrayInput');
/**
* POST createUsersWithListInput
* Summary: Creates list of users with given input array
* Notes:
* Output-Formats: [application/xml, application/json]
*/
$app->POST('/user/createWithList', 'UserApi@createUsersWithListInput');
$app->POST('/v2/user/createWithList', 'UserApi@createUsersWithListInput');
/**
* GET loginUser
* Summary: Logs user into the system
* Notes:
* Output-Formats: [application/xml, application/json]
*/
$app->GET('/user/login', 'UserApi@loginUser');
$app->GET('/v2/user/login', 'UserApi@loginUser');
/**
* GET logoutUser
* Summary: Logs out current logged in user session
* Notes:
* Output-Formats: [application/xml, application/json]
*/
$app->GET('/user/logout', 'UserApi@logoutUser');
$app->GET('/v2/user/logout', 'UserApi@logoutUser');
/**
* DELETE deleteUser
* Summary: Delete user
* Notes: This can only be done by the logged in user.
* Output-Formats: [application/xml, application/json]
*/
$app->DELETE('/user/{username}', 'UserApi@deleteUser');
$app->DELETE('/v2/user/{username}', 'UserApi@deleteUser');
/**
* GET getUserByName
* Summary: Get user by user name
* Notes:
* Output-Formats: [application/xml, application/json]
*/
$app->GET('/user/{username}', 'UserApi@getUserByName');
$app->GET('/v2/user/{username}', 'UserApi@getUserByName');
/**
* PUT updateUser
* Summary: Updated user
* Notes: This can only be done by the logged in user.
* Output-Formats: [application/xml, application/json]
*/
$app->PUT('/user/{username}', 'UserApi@updateUser');
$app->PUT('/v2/user/{username}', 'UserApi@updateUser');