Open wing328 opened 7 years ago
I will work on this, as you can see above, I already needed to do some fixes.
@wing328 Hi, i am having some syntax issues when I generate the Petstore example. Mainly, the syntax errors occur in the interface classes in the API directory. See some of the examples below:
StoreApiInterface.php
namespace Swagger\Server\Api;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Swagger\Server\Model\Order;
**use maparray<string,int>;**
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
UserApiInterface.php
public function createUsersWithArrayInput(**User[]** $body);
public function createUsersWithListInput(User[] $body);
As far as I know, it is not possible to use array of objects in this way.
PetApiInterface.php
namespace Swagger\Server\Api;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Swagger\Server\Model\Pet;
use Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException;
use Swagger\Server\Model\ApiResponse;
**use string[];**
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
public function findPetsByStatus(string[] $status);
public function findPetsByTags(string[] $tags);
I don't think it is possible to create array of strings this way as well.
You can try to generate the example yourself to get a better understanding of this issue.
I can create a separate issue regarding this matter and create a pull request with the solution to solve this matter.
Found a bug where in Validation does not work on nested objects.
A fix would be to add @Assert\Valid()
annotation to model properties that are Object Models or array Object Models
Description
Here are some enhancements for PHP Symfony generator:
camelize
instead ofinitialCaps
Please feel free to reply if you've any other suggestions.
Swagger-codegen version
Latest master
Related issues
https://github.com/swagger-api/swagger-codegen/pull/5973
Suggest a Fix
If anyone wants to work on these enhancements, please reply to let us know.
cc @ksm2