We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The PHP Client Generator doesn't generate all available discriminator options
in Params.php (after generation) we get:
Params.php
public const SERVICE_PROP0 = 'Prop0'; /** * Gets allowable values of the enum * * @return string[] */ public function getServiceAllowableValues() { return [ self::SERVICE_PROP0, ]; }
when we should instead be seeing:
public const SERVICE_PROP0 = 'Prop0'; public const SERVICE_PROP1 = 'Prop1'; /** * Gets allowable values of the enum * * @return string[] */ public function getServiceAllowableValues() { return [ self::SERVICE_PROP0, self::SERVICE_PROP1, ]; }
npm: "@openapitools/openapi-generator-cli": "^2.15.3", jar: 7.10.0
"@openapitools/openapi-generator-cli": "^2.15.3",
7.10.0
Untitled-1.json https://dpaste.org/k2Qoe
Untitled-1.json
openapitools.config.yml
generatorName: php-nextgen outputDir: core/client globalProperties: models: "" apis: "" supportingFiles: "README.md,ApiException.php,Configuration.php,HeaderSelector.php,ObjectSerializer.php,ModelInterface.php"
openapi-generator-cli generate -i Untitled-1.json -c openapitools.config.yml
Generate the php-nextgen client using the command, configuration and json (as an example) provided above
It seems the issue has to do with these lines:
openapi-generator/modules/openapi-generator/src/main/resources/php-nextgen/model_generic.mustache
Lines 193 to 216 in 289425b
Probably present in other PHP client generators as well.
The text was updated successfully, but these errors were encountered:
Additionally it would seem that, with the same setup as above, the lines:
Lines 243 to 247 in 289425b
Interfere with the construction of the Params object: Params.php
Params
public function __construct(array $data = null) { $this->setIfExists('service', $data ?? [], 'Prop0'); $this->setIfExists('prop1', $data ?? [], null); $this->setIfExists('prop0', $data ?? [], null); // Initialize discriminator property with the model name. $this->container['service'] = static::$openAPIModelName; // Overwrites the `setIfExists` above }
Sorry, something went wrong.
fix: OpenAPITools#20343
47c14d5
401c8d0
No branches or pull requests
Bug Report Checklist
Description
The PHP Client Generator doesn't generate all available discriminator options
in
Params.php
(after generation) we get:when we should instead be seeing:
openapi-generator version
npm:
"@openapitools/openapi-generator-cli": "^2.15.3",
jar:
7.10.0
OpenAPI declaration file content or url
Untitled-1.json
https://dpaste.org/k2Qoe
Generation Details
openapitools.config.yml
Steps to reproduce
Generate the php-nextgen client using the command, configuration and json (as an example) provided above
Related issues/PRs
Suggest a fix
It seems the issue has to do with these lines:
openapi-generator/modules/openapi-generator/src/main/resources/php-nextgen/model_generic.mustache
Lines 193 to 216 in 289425b
Probably present in other PHP client generators as well.
The text was updated successfully, but these errors were encountered: