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 generator sets a field type as mixed when the field can be one of at least 2 types. As seen in the following with value.
mixed
value
https://github.com/ory/kratos-client-php/blob/e072b3b5bd5abdde83b4197aae0ba87a79e44cb1/lib/Model/UiNodeAttributes.php#L62-L74
protected static $openAPITypes = [ 'disabled' => 'bool', 'label' => '\Ory\Kratos\Client\Model\UiText', 'name' => 'string', 'pattern' => 'string', 'required' => 'bool', 'type' => 'string', 'value' => 'mixed', <----- ## HERE ## 'text' => '\Ory\Kratos\Client\Model\UiText', 'src' => 'string', 'href' => 'string', 'title' => '\Ory\Kratos\Client\Model\UiText' ];
Here value can be one of these values.. string, number or boolean -> the generator makes it a mixed:
string
number
boolean
https://github.com/ory/kratos/blob/e3cf3da357dfbaa64181d7bfbfe42d1f00b6ef7b/.schema/openapi.json#L1080-L1096 https://github.com/ory/kratos/blob/e3cf3da357dfbaa64181d7bfbfe42d1f00b6ef7b/.schema/openapi.json#L1141-L1155
[...] "value": { "description": "The input's value.", "nullable": true, "oneOf": [ { "type": "string" }, { "type": "number" }, { "type": "boolean" } ] } [...]
Later in the generated ObjectSerializer it tries to use settype() for the current data with type mixed, but mixed is not valid for settype() and it never was valid for it either. I don't know how that code came in here. https://www.php.net/manual/en/function.settype.php#refsect1-function.settype-parameters
settype()
Line:
openapi-generator/modules/openapi-generator/src/main/resources/php/ObjectSerializer.mustache
Lines 323 to 327 in 1d64822
Generated Line:
openapi-generator/samples/client/petstore/php/OpenAPIClient-php/lib/ObjectSerializer.php
Lines 332 to 336 in 1d64822
When he tries to use settype(<value of field 'value'>, 'mixed') it fails with:
settype(<value of field 'value'>, 'mixed')
settype(): Argument #2 ($type) must be a valid type
Because mixed is not a valid type: https://www.php.net/manual/en/function.settype.php#refsect1-function.settype-parameters
5.2.1
https://github.com/ory/kratos/blob/master/.schema/openapi.json
#10576
The text was updated successfully, but these errors were encountered:
Successfully merging a pull request may close this issue.
Bug Report Checklist
Description
The PHP generator sets a field type as
mixed
when the field can be one of at least 2 types. As seen in the following withvalue
.https://github.com/ory/kratos-client-php/blob/e072b3b5bd5abdde83b4197aae0ba87a79e44cb1/lib/Model/UiNodeAttributes.php#L62-L74
Here value can be one of these values..
string
,number
orboolean
-> the generator makes it amixed
:https://github.com/ory/kratos/blob/e3cf3da357dfbaa64181d7bfbfe42d1f00b6ef7b/.schema/openapi.json#L1080-L1096
https://github.com/ory/kratos/blob/e3cf3da357dfbaa64181d7bfbfe42d1f00b6ef7b/.schema/openapi.json#L1141-L1155
Later in the generated ObjectSerializer it tries to use
settype()
for the current data with typemixed
, butmixed
is not valid forsettype()
and it never was valid for it either. I don't know how that code came in here. https://www.php.net/manual/en/function.settype.php#refsect1-function.settype-parametersLine:
openapi-generator/modules/openapi-generator/src/main/resources/php/ObjectSerializer.mustache
Lines 323 to 327 in 1d64822
Generated Line:
openapi-generator/samples/client/petstore/php/OpenAPIClient-php/lib/ObjectSerializer.php
Lines 332 to 336 in 1d64822
When he tries to use
settype(<value of field 'value'>, 'mixed')
it fails with:Because
mixed
is not a valid type: https://www.php.net/manual/en/function.settype.php#refsect1-function.settype-parametersopenapi-generator version
5.2.1
OpenAPI declaration file content or url
https://github.com/ory/kratos/blob/master/.schema/openapi.json
Generation Details
Steps to reproduce
Related issues/PRs
#10576
Suggest a fix
#10576
The text was updated successfully, but these errors were encountered: