Created by: ybelenko
PR checklist
-
Read the contribution guidelines. -
Ran the shell script under ./bin/
to update Petstore sample so that CIs can verify the change. (For instance, only need to run./bin/{LANG}-petstore.sh
and./bin/security/{LANG}-petstore.sh
if updating the {LANG} (e.g. php, ruby, python, etc) code generator or {LANG} client's mustache templates). Windows batch files can be found in.\bin\windows\
. -
Filed the PR against the correct branch: master
,3.4.x
,4.0.x
. Default:master
. -
Copied the technical committee to review the pull request if your PR is targeting a particular programming language.
Description of the PR
Inspired by #426
Generator produces abstract API controller classes which needs to be extended by implementation classes in ./src
folder.
When implementation class doesn't exist application throws exception:
How about implementing getPetById as a GET method in OpenAPIServer\Api\PetApi class?
Upgrade note
Do not modify abstract API controllers directly! Instead extend them by implementation classes like:
// src/Api/PetApi.php
namespace OpenAPIServer\Api;
use OpenAPIServer\Api\AbstractPetApi;
class PetApi extends AbstractPetApi
{
public function addPet($request, $response, $args)
{
// your implementation of addPet method here
}
}
Place all your implementation classes in ./src
folder accordingly.
For instance, when abstract class located at ./lib/Api/AbstractPetApi.php
you need to create implementation class at ./src/Api/PetApi.php
.
Run $ composer dump-autoload
every time your create new class.
To show error details with Slim modify index.php
:
---$router = new SlimRouter();
+++$router = new SlimRouter(['settings' => ['displayErrorDetails' => true]]);
cc @jebentier @dkarlovi @mandrean @jfastnacht @ackintosh