Merge pull request #3422 from wing328/bug/fix-3418

[PHP][Slim] Add missing context path
This commit is contained in:
wing328 2016-07-20 16:05:25 +08:00 committed by GitHub
commit 269c657471
3 changed files with 29 additions and 21 deletions

8
bin/objc-petstore-all.sh Executable file
View File

@ -0,0 +1,8 @@
#!/bin/sh
# default setting
./bin/objc-petstore.sh
# coredata support
./bin/objc-petstore-coredata.sh

View File

@ -15,7 +15,7 @@ $app = new Slim\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}}', function($request, $response, $args) { $app->{{httpMethod}}('{{basePathWithoutHost}}{{path}}', function($request, $response, $args) {
{{#hasHeaderParams}}$headers = $request->getHeaders();{{/hasHeaderParams}} {{#hasHeaderParams}}$headers = $request->getHeaders();{{/hasHeaderParams}}
{{#hasQueryParams}}$queryParams = $request->getQueryParams(); {{#hasQueryParams}}$queryParams = $request->getQueryParams();
{{#queryParams}}${{paramName}} = $queryParams['{{paramName}}'];{{newline}} {{/queryParams}}{{/hasQueryParams}} {{#queryParams}}${{paramName}} = $queryParams['{{paramName}}'];{{newline}} {{/queryParams}}{{/hasQueryParams}}

View File

@ -15,7 +15,7 @@ $app = new Slim\App();
* Notes: * Notes:
* Output-Formats: [application/xml, application/json] * Output-Formats: [application/xml, application/json]
*/ */
$app->POST('/pet', function($request, $response, $args) { $app->POST('/v2/pet', function($request, $response, $args) {
@ -31,7 +31,7 @@ $app->POST('/pet', function($request, $response, $args) {
* Notes: * Notes:
* Output-Formats: [application/xml, application/json] * Output-Formats: [application/xml, application/json]
*/ */
$app->DELETE('/pet/{petId}', function($request, $response, $args) { $app->DELETE('/v2/pet/{petId}', function($request, $response, $args) {
$headers = $request->getHeaders(); $headers = $request->getHeaders();
@ -47,7 +47,7 @@ $app->DELETE('/pet/{petId}', function($request, $response, $args) {
* 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', function($request, $response, $args) { $app->GET('/v2/pet/findByStatus', function($request, $response, $args) {
$queryParams = $request->getQueryParams(); $queryParams = $request->getQueryParams();
$status = $queryParams['status']; $status = $queryParams['status'];
@ -64,7 +64,7 @@ $app->GET('/pet/findByStatus', function($request, $response, $args) {
* 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', function($request, $response, $args) { $app->GET('/v2/pet/findByTags', function($request, $response, $args) {
$queryParams = $request->getQueryParams(); $queryParams = $request->getQueryParams();
$tags = $queryParams['tags']; $tags = $queryParams['tags'];
@ -81,7 +81,7 @@ $app->GET('/pet/findByTags', function($request, $response, $args) {
* 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}', function($request, $response, $args) { $app->GET('/v2/pet/{petId}', function($request, $response, $args) {
@ -97,7 +97,7 @@ $app->GET('/pet/{petId}', function($request, $response, $args) {
* Notes: * Notes:
* Output-Formats: [application/xml, application/json] * Output-Formats: [application/xml, application/json]
*/ */
$app->PUT('/pet', function($request, $response, $args) { $app->PUT('/v2/pet', function($request, $response, $args) {
@ -113,7 +113,7 @@ $app->PUT('/pet', function($request, $response, $args) {
* Notes: * Notes:
* Output-Formats: [application/xml, application/json] * Output-Formats: [application/xml, application/json]
*/ */
$app->POST('/pet/{petId}', function($request, $response, $args) { $app->POST('/v2/pet/{petId}', function($request, $response, $args) {
$name = $args['name']; $status = $args['status']; $name = $args['name']; $status = $args['status'];
@ -129,7 +129,7 @@ $app->POST('/pet/{petId}', function($request, $response, $args) {
* Notes: * Notes:
* Output-Formats: [application/json] * Output-Formats: [application/json]
*/ */
$app->POST('/pet/{petId}/uploadImage', function($request, $response, $args) { $app->POST('/v2/pet/{petId}/uploadImage', function($request, $response, $args) {
$additionalMetadata = $args['additionalMetadata']; $file = $args['file']; $additionalMetadata = $args['additionalMetadata']; $file = $args['file'];
@ -145,7 +145,7 @@ $app->POST('/pet/{petId}/uploadImage', function($request, $response, $args) {
* 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}', function($request, $response, $args) { $app->DELETE('/v2/store/order/{orderId}', function($request, $response, $args) {
@ -161,7 +161,7 @@ $app->DELETE('/store/order/{orderId}', function($request, $response, $args) {
* 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', function($request, $response, $args) { $app->GET('/v2/store/inventory', function($request, $response, $args) {
@ -177,7 +177,7 @@ $app->GET('/store/inventory', function($request, $response, $args) {
* 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}', function($request, $response, $args) { $app->GET('/v2/store/order/{orderId}', function($request, $response, $args) {
@ -193,7 +193,7 @@ $app->GET('/store/order/{orderId}', function($request, $response, $args) {
* Notes: * Notes:
* Output-Formats: [application/xml, application/json] * Output-Formats: [application/xml, application/json]
*/ */
$app->POST('/store/order', function($request, $response, $args) { $app->POST('/v2/store/order', function($request, $response, $args) {
@ -209,7 +209,7 @@ $app->POST('/store/order', function($request, $response, $args) {
* 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', function($request, $response, $args) { $app->POST('/v2/user', function($request, $response, $args) {
@ -225,7 +225,7 @@ $app->POST('/user', function($request, $response, $args) {
* Notes: * Notes:
* Output-Formats: [application/xml, application/json] * Output-Formats: [application/xml, application/json]
*/ */
$app->POST('/user/createWithArray', function($request, $response, $args) { $app->POST('/v2/user/createWithArray', function($request, $response, $args) {
@ -241,7 +241,7 @@ $app->POST('/user/createWithArray', function($request, $response, $args) {
* Notes: * Notes:
* Output-Formats: [application/xml, application/json] * Output-Formats: [application/xml, application/json]
*/ */
$app->POST('/user/createWithList', function($request, $response, $args) { $app->POST('/v2/user/createWithList', function($request, $response, $args) {
@ -257,7 +257,7 @@ $app->POST('/user/createWithList', function($request, $response, $args) {
* 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}', function($request, $response, $args) { $app->DELETE('/v2/user/{username}', function($request, $response, $args) {
@ -273,7 +273,7 @@ $app->DELETE('/user/{username}', function($request, $response, $args) {
* Notes: * Notes:
* Output-Formats: [application/xml, application/json] * Output-Formats: [application/xml, application/json]
*/ */
$app->GET('/user/{username}', function($request, $response, $args) { $app->GET('/v2/user/{username}', function($request, $response, $args) {
@ -289,7 +289,7 @@ $app->GET('/user/{username}', function($request, $response, $args) {
* Notes: * Notes:
* Output-Formats: [application/xml, application/json] * Output-Formats: [application/xml, application/json]
*/ */
$app->GET('/user/login', function($request, $response, $args) { $app->GET('/v2/user/login', function($request, $response, $args) {
$queryParams = $request->getQueryParams(); $queryParams = $request->getQueryParams();
$username = $queryParams['username']; $password = $queryParams['password']; $username = $queryParams['username']; $password = $queryParams['password'];
@ -306,7 +306,7 @@ $app->GET('/user/login', function($request, $response, $args) {
* Notes: * Notes:
* Output-Formats: [application/xml, application/json] * Output-Formats: [application/xml, application/json]
*/ */
$app->GET('/user/logout', function($request, $response, $args) { $app->GET('/v2/user/logout', function($request, $response, $args) {
@ -322,7 +322,7 @@ $app->GET('/user/logout', function($request, $response, $args) {
* 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}', function($request, $response, $args) { $app->PUT('/v2/user/{username}', function($request, $response, $args) {