forked from loafle/openapi-generator-original
[PHP] Remove NUMBER_ prefix from enum vars if a name is provided, show enum descriptions (#19555)
* Remove NUMBER_ prefix from enum vars if a name is provided, show enum descriptions * Update php model tests
This commit is contained in:
parent
bbafeaed40
commit
a5384d42b4
@ -684,6 +684,28 @@ public abstract class AbstractPhpCodegen extends DefaultCodegen implements Codeg
|
||||
p.example = example;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void updateEnumVarsWithExtensions(List<Map<String, Object>> enumVars, Map<String, Object> vendorExtensions, String dataType) {
|
||||
if (vendorExtensions != null) {
|
||||
if (vendorExtensions.containsKey("x-enum-varnames")) {
|
||||
List<String> values = (List<String>) vendorExtensions.get("x-enum-varnames");
|
||||
int size = Math.min(enumVars.size(), values.size());
|
||||
|
||||
for (int i = 0; i < size; i++) {
|
||||
enumVars.get(i).put("name", toEnumVarName(values.get(i), dataType));
|
||||
}
|
||||
}
|
||||
|
||||
if (vendorExtensions.containsKey("x-enum-descriptions")) {
|
||||
List<String> values = (List<String>) vendorExtensions.get("x-enum-descriptions");
|
||||
int size = Math.min(enumVars.size(), values.size());
|
||||
for (int i = 0; i < size; i++) {
|
||||
enumVars.get(i).put("enumDescription", values.get(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toEnumValue(String value, String datatype) {
|
||||
if ("int".equals(datatype) || "float".equals(datatype)) {
|
||||
@ -704,11 +726,11 @@ public abstract class AbstractPhpCodegen extends DefaultCodegen implements Codeg
|
||||
return enumNameMapping.get(name);
|
||||
}
|
||||
|
||||
if (name.length() == 0) {
|
||||
if (name.isEmpty()) {
|
||||
return "EMPTY";
|
||||
}
|
||||
|
||||
if (name.trim().length() == 0) {
|
||||
if (name.trim().isEmpty()) {
|
||||
return "SPACE_" + name.length();
|
||||
}
|
||||
|
||||
@ -719,11 +741,12 @@ public abstract class AbstractPhpCodegen extends DefaultCodegen implements Codeg
|
||||
|
||||
// number
|
||||
if ("int".equals(datatype) || "float".equals(datatype)) {
|
||||
String varName = name;
|
||||
varName = varName.replaceAll("-", "MINUS_");
|
||||
varName = varName.replaceAll("\\+", "PLUS_");
|
||||
varName = varName.replaceAll("\\.", "_DOT_");
|
||||
return varName;
|
||||
if (name.matches("\\d.*")) { // starts with number
|
||||
name = "NUMBER_" + name;
|
||||
}
|
||||
name = name.replaceAll("-", "MINUS_");
|
||||
name = name.replaceAll("\\+", "PLUS_");
|
||||
name = name.replaceAll("\\.", "_DOT_");
|
||||
}
|
||||
|
||||
// string
|
||||
|
@ -374,22 +374,4 @@ public class PhpLaravelServerCodegen extends AbstractPhpCodegen {
|
||||
public String toEnumDefaultValue(String value, String datatype) {
|
||||
return datatype + "::" + value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toEnumVarName(String value, String datatype) {
|
||||
if (value.length() == 0) {
|
||||
return super.toEnumVarName(value, datatype);
|
||||
}
|
||||
|
||||
// number
|
||||
if ("int".equals(datatype) || "float".equals(datatype)) {
|
||||
String varName = "NUMBER_" + value;
|
||||
varName = varName.replaceAll("-", "MINUS_");
|
||||
varName = varName.replaceAll("\\+", "PLUS_");
|
||||
varName = varName.replaceAll("\\.", "_DOT_");
|
||||
return varName;
|
||||
}
|
||||
|
||||
return super.toEnumVarName(value, datatype);
|
||||
}
|
||||
}
|
||||
|
@ -2,8 +2,15 @@ enum {{classname}}: {{vendorExtensions.x-php-enum-type}}
|
||||
{
|
||||
{{#allowableValues}}
|
||||
{{#enumVars}}
|
||||
case {{^isString}}NUMBER_{{/isString}}{{{name}}} = {{{value}}};
|
||||
{{#enumDescription}}
|
||||
/**
|
||||
* {{enumDescription}}
|
||||
*/
|
||||
{{/enumDescription}}
|
||||
case {{{name}}} = {{{value}}};
|
||||
{{^-last}}
|
||||
|
||||
{{/-last}}
|
||||
{{/enumVars}}
|
||||
{{/allowableValues}}
|
||||
}
|
||||
|
@ -5,7 +5,12 @@ class {{classname}}
|
||||
*/
|
||||
{{#allowableValues}}
|
||||
{{#enumVars}}
|
||||
public const {{^isString}}NUMBER_{{/isString}}{{{name}}} = {{{value}}};
|
||||
{{#enumDescription}}
|
||||
/**
|
||||
* {{enumDescription}}
|
||||
*/
|
||||
{{/enumDescription}}
|
||||
public const {{{name}}} = {{{value}}};
|
||||
|
||||
{{/enumVars}}
|
||||
{{/allowableValues}}
|
||||
@ -18,7 +23,7 @@ class {{classname}}
|
||||
return [
|
||||
{{#allowableValues}}
|
||||
{{#enumVars}}
|
||||
self::{{^isString}}NUMBER_{{/isString}}{{{name}}}{{^-last}},
|
||||
self::{{{name}}}{{^-last}},
|
||||
{{/-last}}
|
||||
{{/enumVars}}
|
||||
{{/allowableValues}}
|
||||
|
@ -348,7 +348,7 @@ public class PhpModelTest {
|
||||
Assert.assertEquals(prope.allowableValues.get("values"), Arrays.asList(1, -1));
|
||||
|
||||
HashMap<String, Object> one = new HashMap<String, Object>();
|
||||
one.put("name", "1");
|
||||
one.put("name", "NUMBER_1");
|
||||
one.put("value", "1");
|
||||
one.put("isString", false);
|
||||
HashMap<String, Object> minusOne = new HashMap<String, Object>();
|
||||
|
@ -2066,4 +2066,19 @@ components:
|
||||
ArrayRef:
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
type: string
|
||||
EnumWithNameAndDescription:
|
||||
type: integer
|
||||
enum:
|
||||
- 1
|
||||
- 2
|
||||
- 3
|
||||
- 4
|
||||
x-enum-varnames:
|
||||
- ONE
|
||||
- "2"
|
||||
- " 3"
|
||||
x-enum-descriptions:
|
||||
- The word one
|
||||
- The digit two
|
||||
- The digit three prefixed by a space
|
||||
|
@ -2076,3 +2076,18 @@ components:
|
||||
type: string
|
||||
type_:
|
||||
type: string
|
||||
EnumWithNameAndDescription:
|
||||
type: integer
|
||||
enum:
|
||||
- 1
|
||||
- 2
|
||||
- 3
|
||||
- 4
|
||||
x-enum-varnames:
|
||||
- ONE
|
||||
- "2"
|
||||
- " 3"
|
||||
x-enum-descriptions:
|
||||
- The word one
|
||||
- The digit two
|
||||
- The digit three prefixed by a space
|
||||
|
@ -42,7 +42,6 @@ enum StringEnumRef: string
|
||||
case FAILURE = 'failure';
|
||||
|
||||
case UNCLASSIFIED = 'unclassified';
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -42,7 +42,6 @@ enum StringEnumRef: string
|
||||
case FAILURE = 'failure';
|
||||
|
||||
case UNCLASSIFIED = 'unclassified';
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -29,6 +29,7 @@ docs/Model/Dog.md
|
||||
docs/Model/EnumArrays.md
|
||||
docs/Model/EnumClass.md
|
||||
docs/Model/EnumTest.md
|
||||
docs/Model/EnumWithNameAndDescription.md
|
||||
docs/Model/FakeBigDecimalMap200Response.md
|
||||
docs/Model/File.md
|
||||
docs/Model/FileSchemaTestClass.md
|
||||
@ -91,6 +92,7 @@ src/Model/Dog.php
|
||||
src/Model/EnumArrays.php
|
||||
src/Model/EnumClass.php
|
||||
src/Model/EnumTest.php
|
||||
src/Model/EnumWithNameAndDescription.php
|
||||
src/Model/FakeBigDecimalMap200Response.php
|
||||
src/Model/File.php
|
||||
src/Model/FileSchemaTestClass.php
|
||||
|
@ -138,6 +138,7 @@ Class | Method | HTTP request | Description
|
||||
- [EnumArrays](docs/Model/EnumArrays.md)
|
||||
- [EnumClass](docs/Model/EnumClass.md)
|
||||
- [EnumTest](docs/Model/EnumTest.md)
|
||||
- [EnumWithNameAndDescription](docs/Model/EnumWithNameAndDescription.md)
|
||||
- [FakeBigDecimalMap200Response](docs/Model/FakeBigDecimalMap200Response.md)
|
||||
- [File](docs/Model/File.md)
|
||||
- [FileSchemaTestClass](docs/Model/FileSchemaTestClass.md)
|
||||
|
@ -0,0 +1,8 @@
|
||||
# # EnumWithNameAndDescription
|
||||
|
||||
## Properties
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
|
||||
[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)
|
@ -41,7 +41,6 @@ enum EnumClass: string
|
||||
case EFG = '-efg';
|
||||
|
||||
case XYZ = '(xyz)';
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -275,9 +275,9 @@ class EnumTest implements ModelInterface, ArrayAccess, JsonSerializable
|
||||
public const ENUM_STRING_REQUIRED_UPPER = 'UPPER';
|
||||
public const ENUM_STRING_REQUIRED_LOWER = 'lower';
|
||||
public const ENUM_STRING_REQUIRED_EMPTY = '';
|
||||
public const ENUM_INTEGER_1 = 1;
|
||||
public const ENUM_INTEGER_NUMBER_1 = 1;
|
||||
public const ENUM_INTEGER_MINUS_1 = -1;
|
||||
public const ENUM_NUMBER_1_DOT_1 = 1.1;
|
||||
public const ENUM_NUMBER_NUMBER_1_DOT_1 = 1.1;
|
||||
public const ENUM_NUMBER_MINUS_1_DOT_2 = -1.2;
|
||||
|
||||
/**
|
||||
@ -316,7 +316,7 @@ class EnumTest implements ModelInterface, ArrayAccess, JsonSerializable
|
||||
public function getEnumIntegerAllowableValues()
|
||||
{
|
||||
return [
|
||||
self::ENUM_INTEGER_1,
|
||||
self::ENUM_INTEGER_NUMBER_1,
|
||||
self::ENUM_INTEGER_MINUS_1,
|
||||
];
|
||||
}
|
||||
@ -329,7 +329,7 @@ class EnumTest implements ModelInterface, ArrayAccess, JsonSerializable
|
||||
public function getEnumNumberAllowableValues()
|
||||
{
|
||||
return [
|
||||
self::ENUM_NUMBER_1_DOT_1,
|
||||
self::ENUM_NUMBER_NUMBER_1_DOT_1,
|
||||
self::ENUM_NUMBER_MINUS_1_DOT_2,
|
||||
];
|
||||
}
|
||||
|
@ -0,0 +1,57 @@
|
||||
<?php
|
||||
/**
|
||||
* EnumWithNameAndDescription
|
||||
*
|
||||
* PHP version 8.1
|
||||
*
|
||||
* @package OpenAPI\Client
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
/**
|
||||
* OpenAPI Petstore
|
||||
*
|
||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
* @generated Generated by: https://openapi-generator.tech
|
||||
* Generator version: 7.9.0-SNAPSHOT
|
||||
*/
|
||||
|
||||
/**
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
namespace OpenAPI\Client\Model;
|
||||
|
||||
/**
|
||||
* EnumWithNameAndDescription Class Doc Comment
|
||||
*
|
||||
* @package OpenAPI\Client
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://openapi-generator.tech
|
||||
*/
|
||||
enum EnumWithNameAndDescription: int
|
||||
{
|
||||
/**
|
||||
* The word one
|
||||
*/
|
||||
case ONE = 1;
|
||||
|
||||
/**
|
||||
* The digit two
|
||||
*/
|
||||
case NUMBER_2 = 2;
|
||||
|
||||
/**
|
||||
* The digit three prefixed by a space
|
||||
*/
|
||||
case _3 = 3;
|
||||
|
||||
case NUMBER_4 = 4;
|
||||
}
|
||||
|
||||
|
@ -41,7 +41,6 @@ enum OuterEnum: string
|
||||
case APPROVED = 'approved';
|
||||
|
||||
case SHIPPED = 'delivered';
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -41,7 +41,6 @@ enum OuterEnumDefaultValue: string
|
||||
case APPROVED = 'approved';
|
||||
|
||||
case SHIPPED = 'delivered';
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -41,7 +41,6 @@ enum OuterEnumInteger: int
|
||||
case NUMBER_1 = 1;
|
||||
|
||||
case NUMBER_2 = 2;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -41,7 +41,6 @@ enum OuterEnumIntegerDefaultValue: int
|
||||
case NUMBER_1 = 1;
|
||||
|
||||
case NUMBER_2 = 2;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -39,7 +39,6 @@ enum SingleRefType: string
|
||||
case ADMIN = 'admin';
|
||||
|
||||
case USER = 'user';
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -0,0 +1,79 @@
|
||||
<?php
|
||||
/**
|
||||
* EnumWithNameAndDescriptionTest
|
||||
*
|
||||
* PHP version 8.1
|
||||
*
|
||||
* @package OpenAPI\Client
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
/**
|
||||
* OpenAPI Petstore
|
||||
*
|
||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
* @generated Generated by: https://openapi-generator.tech
|
||||
* Generator version: 7.9.0-SNAPSHOT
|
||||
*/
|
||||
|
||||
/**
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Please update the test case below to test the model.
|
||||
*/
|
||||
|
||||
namespace OpenAPI\Client\Test\Model;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
/**
|
||||
* EnumWithNameAndDescriptionTest Class Doc Comment
|
||||
*
|
||||
* @description EnumWithNameAndDescription
|
||||
* @package OpenAPI\Client
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://openapi-generator.tech
|
||||
*/
|
||||
class EnumWithNameAndDescriptionTest extends TestCase
|
||||
{
|
||||
|
||||
/**
|
||||
* Setup before running any test case
|
||||
*/
|
||||
public static function setUpBeforeClass(): void
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Setup before running each test case
|
||||
*/
|
||||
public function setUp(): void
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Clean up after running each test case
|
||||
*/
|
||||
public function tearDown(): void
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Clean up after running all test cases
|
||||
*/
|
||||
public static function tearDownAfterClass(): void
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Test "EnumWithNameAndDescription"
|
||||
*/
|
||||
public function testEnumWithNameAndDescription()
|
||||
{
|
||||
// TODO: implement
|
||||
self::markTestIncomplete('Not implemented');
|
||||
}
|
||||
}
|
@ -27,6 +27,7 @@ docs/Model/Dog.md
|
||||
docs/Model/EnumArrays.md
|
||||
docs/Model/EnumClass.md
|
||||
docs/Model/EnumTest.md
|
||||
docs/Model/EnumWithNameAndDescription.md
|
||||
docs/Model/FakeBigDecimalMap200Response.md
|
||||
docs/Model/File.md
|
||||
docs/Model/FileSchemaTestClass.md
|
||||
@ -87,6 +88,7 @@ lib/Model/Dog.php
|
||||
lib/Model/EnumArrays.php
|
||||
lib/Model/EnumClass.php
|
||||
lib/Model/EnumTest.php
|
||||
lib/Model/EnumWithNameAndDescription.php
|
||||
lib/Model/FakeBigDecimalMap200Response.php
|
||||
lib/Model/File.php
|
||||
lib/Model/FileSchemaTestClass.php
|
||||
|
@ -138,6 +138,7 @@ Class | Method | HTTP request | Description
|
||||
- [EnumArrays](docs/Model/EnumArrays.md)
|
||||
- [EnumClass](docs/Model/EnumClass.md)
|
||||
- [EnumTest](docs/Model/EnumTest.md)
|
||||
- [EnumWithNameAndDescription](docs/Model/EnumWithNameAndDescription.md)
|
||||
- [FakeBigDecimalMap200Response](docs/Model/FakeBigDecimalMap200Response.md)
|
||||
- [File](docs/Model/File.md)
|
||||
- [FileSchemaTestClass](docs/Model/FileSchemaTestClass.md)
|
||||
|
@ -0,0 +1,8 @@
|
||||
# # EnumWithNameAndDescription
|
||||
|
||||
## Properties
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
|
||||
[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)
|
@ -276,9 +276,9 @@ class EnumTest implements ModelInterface, ArrayAccess, \JsonSerializable
|
||||
public const ENUM_STRING_REQUIRED_UPPER = 'UPPER';
|
||||
public const ENUM_STRING_REQUIRED_LOWER = 'lower';
|
||||
public const ENUM_STRING_REQUIRED_EMPTY = '';
|
||||
public const ENUM_INTEGER_1 = 1;
|
||||
public const ENUM_INTEGER_NUMBER_1 = 1;
|
||||
public const ENUM_INTEGER_MINUS_1 = -1;
|
||||
public const ENUM_NUMBER_1_DOT_1 = 1.1;
|
||||
public const ENUM_NUMBER_NUMBER_1_DOT_1 = 1.1;
|
||||
public const ENUM_NUMBER_MINUS_1_DOT_2 = -1.2;
|
||||
|
||||
/**
|
||||
@ -317,7 +317,7 @@ class EnumTest implements ModelInterface, ArrayAccess, \JsonSerializable
|
||||
public function getEnumIntegerAllowableValues()
|
||||
{
|
||||
return [
|
||||
self::ENUM_INTEGER_1,
|
||||
self::ENUM_INTEGER_NUMBER_1,
|
||||
self::ENUM_INTEGER_MINUS_1,
|
||||
];
|
||||
}
|
||||
@ -330,7 +330,7 @@ class EnumTest implements ModelInterface, ArrayAccess, \JsonSerializable
|
||||
public function getEnumNumberAllowableValues()
|
||||
{
|
||||
return [
|
||||
self::ENUM_NUMBER_1_DOT_1,
|
||||
self::ENUM_NUMBER_NUMBER_1_DOT_1,
|
||||
self::ENUM_NUMBER_MINUS_1_DOT_2,
|
||||
];
|
||||
}
|
||||
|
@ -0,0 +1,77 @@
|
||||
<?php
|
||||
/**
|
||||
* EnumWithNameAndDescription
|
||||
*
|
||||
* PHP version 7.4
|
||||
*
|
||||
* @category Class
|
||||
* @package OpenAPI\Client
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
/**
|
||||
* OpenAPI Petstore
|
||||
*
|
||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
* Generated by: https://openapi-generator.tech
|
||||
* Generator version: 7.9.0-SNAPSHOT
|
||||
*/
|
||||
|
||||
/**
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
namespace OpenAPI\Client\Model;
|
||||
use \OpenAPI\Client\ObjectSerializer;
|
||||
|
||||
/**
|
||||
* EnumWithNameAndDescription Class Doc Comment
|
||||
*
|
||||
* @category Class
|
||||
* @package OpenAPI\Client
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://openapi-generator.tech
|
||||
*/
|
||||
class EnumWithNameAndDescription
|
||||
{
|
||||
/**
|
||||
* Possible values of this enum
|
||||
*/
|
||||
/**
|
||||
* The word one
|
||||
*/
|
||||
public const ONE = 1;
|
||||
|
||||
/**
|
||||
* The digit two
|
||||
*/
|
||||
public const NUMBER_2 = 2;
|
||||
|
||||
/**
|
||||
* The digit three prefixed by a space
|
||||
*/
|
||||
public const _3 = 3;
|
||||
|
||||
public const NUMBER_4 = 4;
|
||||
|
||||
/**
|
||||
* Gets allowable values of the enum
|
||||
* @return string[]
|
||||
*/
|
||||
public static function getAllowableEnumValues()
|
||||
{
|
||||
return [
|
||||
self::ONE,
|
||||
self::NUMBER_2,
|
||||
self::_3,
|
||||
self::NUMBER_4
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,81 @@
|
||||
<?php
|
||||
/**
|
||||
* EnumWithNameAndDescriptionTest
|
||||
*
|
||||
* PHP version 7.4
|
||||
*
|
||||
* @category Class
|
||||
* @package OpenAPI\Client
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
/**
|
||||
* OpenAPI Petstore
|
||||
*
|
||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
* Generated by: https://openapi-generator.tech
|
||||
* Generator version: 7.9.0-SNAPSHOT
|
||||
*/
|
||||
|
||||
/**
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Please update the test case below to test the model.
|
||||
*/
|
||||
|
||||
namespace OpenAPI\Client\Test\Model;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
/**
|
||||
* EnumWithNameAndDescriptionTest Class Doc Comment
|
||||
*
|
||||
* @category Class
|
||||
* @description EnumWithNameAndDescription
|
||||
* @package OpenAPI\Client
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://openapi-generator.tech
|
||||
*/
|
||||
class EnumWithNameAndDescriptionTest extends TestCase
|
||||
{
|
||||
|
||||
/**
|
||||
* Setup before running any test case
|
||||
*/
|
||||
public static function setUpBeforeClass(): void
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Setup before running each test case
|
||||
*/
|
||||
public function setUp(): void
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Clean up after running each test case
|
||||
*/
|
||||
public function tearDown(): void
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Clean up after running all test cases
|
||||
*/
|
||||
public static function tearDownAfterClass(): void
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Test "EnumWithNameAndDescription"
|
||||
*/
|
||||
public function testEnumWithNameAndDescription()
|
||||
{
|
||||
// TODO: implement
|
||||
self::markTestIncomplete('Not implemented');
|
||||
}
|
||||
}
|
@ -27,6 +27,7 @@ docs/Model/Dog.md
|
||||
docs/Model/EnumArrays.md
|
||||
docs/Model/EnumClass.md
|
||||
docs/Model/EnumTest.md
|
||||
docs/Model/EnumWithNameAndDescription.md
|
||||
docs/Model/FakeBigDecimalMap200Response.md
|
||||
docs/Model/File.md
|
||||
docs/Model/FileSchemaTestClass.md
|
||||
@ -88,6 +89,7 @@ lib/Model/Dog.php
|
||||
lib/Model/EnumArrays.php
|
||||
lib/Model/EnumClass.php
|
||||
lib/Model/EnumTest.php
|
||||
lib/Model/EnumWithNameAndDescription.php
|
||||
lib/Model/FakeBigDecimalMap200Response.php
|
||||
lib/Model/File.php
|
||||
lib/Model/FileSchemaTestClass.php
|
||||
|
@ -149,6 +149,7 @@ Class | Method | HTTP request | Description
|
||||
- [EnumArrays](docs/Model/EnumArrays.md)
|
||||
- [EnumClass](docs/Model/EnumClass.md)
|
||||
- [EnumTest](docs/Model/EnumTest.md)
|
||||
- [EnumWithNameAndDescription](docs/Model/EnumWithNameAndDescription.md)
|
||||
- [FakeBigDecimalMap200Response](docs/Model/FakeBigDecimalMap200Response.md)
|
||||
- [File](docs/Model/File.md)
|
||||
- [FileSchemaTestClass](docs/Model/FileSchemaTestClass.md)
|
||||
|
@ -0,0 +1,8 @@
|
||||
# # EnumWithNameAndDescription
|
||||
|
||||
## Properties
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
|
||||
[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)
|
@ -276,9 +276,9 @@ class EnumTest implements ModelInterface, ArrayAccess, \JsonSerializable
|
||||
public const ENUM_STRING_REQUIRED_UPPER = 'UPPER';
|
||||
public const ENUM_STRING_REQUIRED_LOWER = 'lower';
|
||||
public const ENUM_STRING_REQUIRED_EMPTY = '';
|
||||
public const ENUM_INTEGER_1 = 1;
|
||||
public const ENUM_INTEGER_NUMBER_1 = 1;
|
||||
public const ENUM_INTEGER_MINUS_1 = -1;
|
||||
public const ENUM_NUMBER_1_DOT_1 = 1.1;
|
||||
public const ENUM_NUMBER_NUMBER_1_DOT_1 = 1.1;
|
||||
public const ENUM_NUMBER_MINUS_1_DOT_2 = -1.2;
|
||||
|
||||
/**
|
||||
@ -317,7 +317,7 @@ class EnumTest implements ModelInterface, ArrayAccess, \JsonSerializable
|
||||
public function getEnumIntegerAllowableValues()
|
||||
{
|
||||
return [
|
||||
self::ENUM_INTEGER_1,
|
||||
self::ENUM_INTEGER_NUMBER_1,
|
||||
self::ENUM_INTEGER_MINUS_1,
|
||||
];
|
||||
}
|
||||
@ -330,7 +330,7 @@ class EnumTest implements ModelInterface, ArrayAccess, \JsonSerializable
|
||||
public function getEnumNumberAllowableValues()
|
||||
{
|
||||
return [
|
||||
self::ENUM_NUMBER_1_DOT_1,
|
||||
self::ENUM_NUMBER_NUMBER_1_DOT_1,
|
||||
self::ENUM_NUMBER_MINUS_1_DOT_2,
|
||||
];
|
||||
}
|
||||
|
@ -0,0 +1,77 @@
|
||||
<?php
|
||||
/**
|
||||
* EnumWithNameAndDescription
|
||||
*
|
||||
* PHP version 7.4
|
||||
*
|
||||
* @category Class
|
||||
* @package OpenAPI\Client
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
/**
|
||||
* OpenAPI Petstore
|
||||
*
|
||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
* Generated by: https://openapi-generator.tech
|
||||
* Generator version: 7.9.0-SNAPSHOT
|
||||
*/
|
||||
|
||||
/**
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
namespace OpenAPI\Client\Model;
|
||||
use \OpenAPI\Client\ObjectSerializer;
|
||||
|
||||
/**
|
||||
* EnumWithNameAndDescription Class Doc Comment
|
||||
*
|
||||
* @category Class
|
||||
* @package OpenAPI\Client
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://openapi-generator.tech
|
||||
*/
|
||||
class EnumWithNameAndDescription
|
||||
{
|
||||
/**
|
||||
* Possible values of this enum
|
||||
*/
|
||||
/**
|
||||
* The word one
|
||||
*/
|
||||
public const ONE = 1;
|
||||
|
||||
/**
|
||||
* The digit two
|
||||
*/
|
||||
public const NUMBER_2 = 2;
|
||||
|
||||
/**
|
||||
* The digit three prefixed by a space
|
||||
*/
|
||||
public const _3 = 3;
|
||||
|
||||
public const NUMBER_4 = 4;
|
||||
|
||||
/**
|
||||
* Gets allowable values of the enum
|
||||
* @return string[]
|
||||
*/
|
||||
public static function getAllowableEnumValues()
|
||||
{
|
||||
return [
|
||||
self::ONE,
|
||||
self::NUMBER_2,
|
||||
self::_3,
|
||||
self::NUMBER_4
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,81 @@
|
||||
<?php
|
||||
/**
|
||||
* EnumWithNameAndDescriptionTest
|
||||
*
|
||||
* PHP version 7.4
|
||||
*
|
||||
* @category Class
|
||||
* @package OpenAPI\Client
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
/**
|
||||
* OpenAPI Petstore
|
||||
*
|
||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
* Generated by: https://openapi-generator.tech
|
||||
* Generator version: 7.9.0-SNAPSHOT
|
||||
*/
|
||||
|
||||
/**
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Please update the test case below to test the model.
|
||||
*/
|
||||
|
||||
namespace OpenAPI\Client\Test\Model;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
/**
|
||||
* EnumWithNameAndDescriptionTest Class Doc Comment
|
||||
*
|
||||
* @category Class
|
||||
* @description EnumWithNameAndDescription
|
||||
* @package OpenAPI\Client
|
||||
* @author OpenAPI Generator team
|
||||
* @link https://openapi-generator.tech
|
||||
*/
|
||||
class EnumWithNameAndDescriptionTest extends TestCase
|
||||
{
|
||||
|
||||
/**
|
||||
* Setup before running any test case
|
||||
*/
|
||||
public static function setUpBeforeClass(): void
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Setup before running each test case
|
||||
*/
|
||||
public function setUp(): void
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Clean up after running each test case
|
||||
*/
|
||||
public function tearDown(): void
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Clean up after running all test cases
|
||||
*/
|
||||
public static function tearDownAfterClass(): void
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Test "EnumWithNameAndDescription"
|
||||
*/
|
||||
public function testEnumWithNameAndDescription()
|
||||
{
|
||||
// TODO: implement
|
||||
self::markTestIncomplete('Not implemented');
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user