Fix enum generation for php-symfony generator (#14105)

* fix(symfony): enum generation

* docs(php symfony): update samples and docs
This commit is contained in:
renaud-twd 2022-12-27 05:42:41 -10:00 committed by GitHub
parent 8a2a059887
commit efdc94b113
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 26 additions and 6 deletions

View File

@ -35,5 +35,6 @@ use JMS\Serializer\Annotation\SerializedName;
* @package {{modelPackage}} * @package {{modelPackage}}
* @author OpenAPI Generator team * @author OpenAPI Generator team
*/ */
{{>model_generic}} {{#isEnum}}{{>model_enum}}{{/isEnum}}
{{^isEnum}}{{>model_generic}}{{/isEnum}}
{{/model}}{{/models}} {{/model}}{{/models}}

View File

@ -41,6 +41,7 @@ use JMS\Serializer\Annotation\SerializedName;
* @package OpenAPI\Server\Model * @package OpenAPI\Server\Model
* @author OpenAPI Generator team * @author OpenAPI Generator team
*/ */
class ApiResponse class ApiResponse
{ {
/** /**

View File

@ -41,6 +41,7 @@ use JMS\Serializer\Annotation\SerializedName;
* @package OpenAPI\Server\Model * @package OpenAPI\Server\Model
* @author OpenAPI Generator team * @author OpenAPI Generator team
*/ */
class Category class Category
{ {
/** /**

View File

@ -43,13 +43,26 @@ use JMS\Serializer\Annotation\SerializedName;
*/ */
class EnumStringModel class EnumStringModel
{ {
/** /**
* Constructor * Possible values of this enum
* @param array|null $data Associated array of property values initializing the model
*/ */
public function __construct(array $data = null) const AVAILABLE = "available";
const PENDING = "pending";
const SOLD = "sold";
/**
* Gets allowable values of the enum
* @return string[]
*/
public static function getAllowableEnumValues()
{ {
return [
self::AVAILABLE,
self::PENDING,
self::SOLD,
];
} }
} }

View File

@ -41,6 +41,7 @@ use JMS\Serializer\Annotation\SerializedName;
* @package OpenAPI\Server\Model * @package OpenAPI\Server\Model
* @author OpenAPI Generator team * @author OpenAPI Generator team
*/ */
class Order class Order
{ {
/** /**

View File

@ -41,6 +41,7 @@ use JMS\Serializer\Annotation\SerializedName;
* @package OpenAPI\Server\Model * @package OpenAPI\Server\Model
* @author OpenAPI Generator team * @author OpenAPI Generator team
*/ */
class Pet class Pet
{ {
/** /**

View File

@ -41,6 +41,7 @@ use JMS\Serializer\Annotation\SerializedName;
* @package OpenAPI\Server\Model * @package OpenAPI\Server\Model
* @author OpenAPI Generator team * @author OpenAPI Generator team
*/ */
class Tag class Tag
{ {
/** /**

View File

@ -41,6 +41,7 @@ use JMS\Serializer\Annotation\SerializedName;
* @package OpenAPI\Server\Model * @package OpenAPI\Server\Model
* @author OpenAPI Generator team * @author OpenAPI Generator team
*/ */
class User class User
{ {
/** /**