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}} * Notes: {{notes}}
{{#hasProduces}} * Output-Formats: [{{#produces}}{{{mediaType}}}{{#hasMore}}, {{/hasMore}}{{/produces}}]{{/hasProduces}} {{#hasProduces}} * Output-Formats: [{{#produces}}{{{mediaType}}}{{#hasMore}}, {{/hasMore}}{{/produces}}]{{/hasProduces}}
*/ */
$app->{{httpMethod}}('{{path}}', '{{classname}}@{{operationId}}'); $app->{{httpMethod}}('{{basePathWithoutHost}}{{path}}', '{{classname}}@{{operationId}}');
{{/operation}} {{/operation}}
{{/operations}} {{/operations}}
{{/apis}} {{/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 * Operation testEndpointParameters
* *

View File

@ -33,158 +33,165 @@ $app->get('/', function () use ($app) {
return $app->version(); return $app->version();
}); });
/**
* PATCH testClientModel
* Summary: To test \"client\" model
* Notes:
* Output-Formats: [application/json]
*/
$app->PATCH('/v2/fake', 'FakeApi@testClientModel');
/** /**
* POST testEndpointParameters * POST testEndpointParameters
* Summary: Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 * Summary: Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
* Notes: 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] * 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 * GET testEnumQueryParameters
* Summary: To test enum query parameters * Summary: To test enum query parameters
* Notes: * Notes:
* Output-Formats: [application/json] * Output-Formats: [application/json]
*/ */
$app->GET('/fake', 'FakeApi@testEnumQueryParameters'); $app->GET('/v2/fake', 'FakeApi@testEnumQueryParameters');
/** /**
* 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/xml, application/json]
*/ */
$app->POST('/pet', 'PetApi@addPet'); $app->POST('/v2/pet', 'PetApi@addPet');
/** /**
* 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/xml, application/json]
*/ */
$app->PUT('/pet', 'PetApi@updatePet'); $app->PUT('/v2/pet', 'PetApi@updatePet');
/** /**
* GET findPetsByStatus * GET findPetsByStatus
* Summary: Finds Pets by status * Summary: Finds Pets by status
* Notes: Multiple status values can be provided with comma separated strings * Notes: Multiple status values can be provided with comma separated strings
* Output-Formats: [application/xml, application/json] * Output-Formats: [application/xml, application/json]
*/ */
$app->GET('/pet/findByStatus', 'PetApi@findPetsByStatus'); $app->GET('/v2/pet/findByStatus', 'PetApi@findPetsByStatus');
/** /**
* GET findPetsByTags * GET findPetsByTags
* Summary: Finds Pets by tags * Summary: Finds Pets by tags
* Notes: Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. * Notes: Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
* Output-Formats: [application/xml, application/json] * Output-Formats: [application/xml, application/json]
*/ */
$app->GET('/pet/findByTags', 'PetApi@findPetsByTags'); $app->GET('/v2/pet/findByTags', 'PetApi@findPetsByTags');
/** /**
* DELETE deletePet * DELETE deletePet
* Summary: Deletes a pet * Summary: Deletes a pet
* Notes: * Notes:
* Output-Formats: [application/xml, application/json] * Output-Formats: [application/xml, application/json]
*/ */
$app->DELETE('/pet/{petId}', 'PetApi@deletePet'); $app->DELETE('/v2/pet/{petId}', 'PetApi@deletePet');
/** /**
* GET getPetById * GET getPetById
* Summary: Find pet by ID * Summary: Find pet by ID
* Notes: Returns a single pet * Notes: Returns a single pet
* Output-Formats: [application/xml, application/json] * Output-Formats: [application/xml, application/json]
*/ */
$app->GET('/pet/{petId}', 'PetApi@getPetById'); $app->GET('/v2/pet/{petId}', 'PetApi@getPetById');
/** /**
* 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/xml, application/json]
*/ */
$app->POST('/pet/{petId}', 'PetApi@updatePetWithForm'); $app->POST('/v2/pet/{petId}', 'PetApi@updatePetWithForm');
/** /**
* POST uploadFile * POST uploadFile
* Summary: uploads an image * Summary: uploads an image
* Notes: * Notes:
* Output-Formats: [application/json] * Output-Formats: [application/json]
*/ */
$app->POST('/pet/{petId}/uploadImage', 'PetApi@uploadFile'); $app->POST('/v2/pet/{petId}/uploadImage', 'PetApi@uploadFile');
/** /**
* GET getInventory * GET getInventory
* Summary: Returns pet inventories by status * Summary: Returns pet inventories by status
* Notes: Returns a map of status codes to quantities * Notes: Returns a map of status codes to quantities
* Output-Formats: [application/json] * Output-Formats: [application/json]
*/ */
$app->GET('/store/inventory', 'StoreApi@getInventory'); $app->GET('/v2/store/inventory', 'StoreApi@getInventory');
/** /**
* POST placeOrder * POST placeOrder
* Summary: Place an order for a pet * Summary: Place an order for a pet
* Notes: * Notes:
* Output-Formats: [application/xml, application/json] * Output-Formats: [application/xml, application/json]
*/ */
$app->POST('/store/order', 'StoreApi@placeOrder'); $app->POST('/v2/store/order', 'StoreApi@placeOrder');
/** /**
* DELETE deleteOrder * DELETE deleteOrder
* Summary: Delete purchase order by ID * 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 * 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] * Output-Formats: [application/xml, application/json]
*/ */
$app->DELETE('/store/order/{orderId}', 'StoreApi@deleteOrder'); $app->DELETE('/v2/store/order/{orderId}', 'StoreApi@deleteOrder');
/** /**
* GET getOrderById * GET getOrderById
* Summary: Find purchase order by ID * Summary: Find purchase order by ID
* Notes: For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions * Notes: For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
* Output-Formats: [application/xml, application/json] * Output-Formats: [application/xml, application/json]
*/ */
$app->GET('/store/order/{orderId}', 'StoreApi@getOrderById'); $app->GET('/v2/store/order/{orderId}', 'StoreApi@getOrderById');
/** /**
* 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/xml, application/json]
*/ */
$app->POST('/user', 'UserApi@createUser'); $app->POST('/v2/user', 'UserApi@createUser');
/** /**
* 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/xml, application/json]
*/ */
$app->POST('/user/createWithArray', 'UserApi@createUsersWithArrayInput'); $app->POST('/v2/user/createWithArray', 'UserApi@createUsersWithArrayInput');
/** /**
* 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/xml, application/json]
*/ */
$app->POST('/user/createWithList', 'UserApi@createUsersWithListInput'); $app->POST('/v2/user/createWithList', 'UserApi@createUsersWithListInput');
/** /**
* 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/xml, application/json]
*/ */
$app->GET('/user/login', 'UserApi@loginUser'); $app->GET('/v2/user/login', 'UserApi@loginUser');
/** /**
* 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/xml, application/json]
*/ */
$app->GET('/user/logout', 'UserApi@logoutUser'); $app->GET('/v2/user/logout', 'UserApi@logoutUser');
/** /**
* 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/xml, application/json]
*/ */
$app->DELETE('/user/{username}', 'UserApi@deleteUser'); $app->DELETE('/v2/user/{username}', 'UserApi@deleteUser');
/** /**
* 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/xml, application/json]
*/ */
$app->GET('/user/{username}', 'UserApi@getUserByName'); $app->GET('/v2/user/{username}', 'UserApi@getUserByName');
/** /**
* 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/xml, application/json]
*/ */
$app->PUT('/user/{username}', 'UserApi@updateUser'); $app->PUT('/v2/user/{username}', 'UserApi@updateUser');