Skip to content

Commit

Permalink
Fix enum generation for php-symfony generator (OpenAPITools#14105)
Browse files Browse the repository at this point in the history
* fix(symfony): enum generation

* docs(php symfony): update samples and docs
  • Loading branch information
renaud-twd authored Dec 27, 2022
1 parent 8a2a059 commit efdc94b
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,6 @@ use JMS\Serializer\Annotation\SerializedName;
* @package {{modelPackage}}
* @author OpenAPI Generator team
*/
{{>model_generic}}
{{#isEnum}}{{>model_enum}}{{/isEnum}}
{{^isEnum}}{{>model_generic}}{{/isEnum}}
{{/model}}{{/models}}
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
* @package OpenAPI\Server\Model
* @author OpenAPI Generator team
*/

class ApiResponse
{
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
* @package OpenAPI\Server\Model
* @author OpenAPI Generator team
*/

class Category
{
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,28 @@
* @package OpenAPI\Server\Model
* @author OpenAPI Generator team
*/
class EnumStringModel
class EnumStringModel
{
/**
* Constructor
* @param array|null $data Associated array of property values initializing the model
/**
* Possible values of this enum
*/
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,
];
}
}



Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
* @package OpenAPI\Server\Model
* @author OpenAPI Generator team
*/

class Order
{
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
* @package OpenAPI\Server\Model
* @author OpenAPI Generator team
*/

class Pet
{
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
* @package OpenAPI\Server\Model
* @author OpenAPI Generator team
*/

class Tag
{
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
* @package OpenAPI\Server\Model
* @author OpenAPI Generator team
*/

class User
{
/**
Expand Down

0 comments on commit efdc94b

Please sign in to comment.