[Php] Convert boolean value for query string (additional option)#11880
[Php] Convert boolean value for query string (additional option)#11880ksvirkou-hubspot wants to merge 18 commits intoOpenAPITools:masterfrom ksvirkou-hubspot:feature/queryParamValues
Conversation
|
@jebentier , @dkarlovi , @mandrean , @jfastnacht , @ackintosh , @ybelenko , @renepardon |
|
Hi Everyone |
|
Ohh, you're fixing the same part of generator that I do right now... I changed We can't merge this PR before #11225. I can integrate your changes into new method later, don't worry. If you want to help, you can write unit tests at |
|
It cannot be merged without at least few unit tests, so please describe some test cases, so we can cover your feature. |
|
@ybelenko |
merge master
# Conflicts: # modules/openapi-generator/src/main/resources/php/ObjectSerializer.mustache # modules/openapi-generator/src/main/resources/php/api.mustache # samples/client/petstore/php/OpenAPIClient-php/lib/Api/FakeApi.php # samples/client/petstore/php/OpenAPIClient-php/lib/Api/PetApi.php # samples/client/petstore/php/OpenAPIClient-php/lib/Api/UserApi.php # samples/client/petstore/php/OpenAPIClient-php/lib/ObjectSerializer.php
samples/client/petstore/php/OpenAPIClient-php/tests/ObjectSerializerTest.php
Outdated
Show resolved
Hide resolved
| |allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false| | ||
| |apiPackage|package for generated api classes| |null| | ||
| |artifactVersion|The version to use in the composer package version field. e.g. 1.2.3| |null| | ||
| |booleanFormatForQueryString|Specifies the format for converting boolean to query string. The default is 'int'.(e.g. int param=1 or param=0 string param=true or param=false)|<dl><dt>**int**</dt><dd>int</dd><dt>**string**</dt><dd>string</dd></dl>|int| |
There was a problem hiding this comment.
Additional codegen option, really? Are you sure there are many users who need this?
Beside why not to add that option to modules/openapi-generator/src/main/resources/php/Configuration.mustache instead? That way you can change bool serialization without regeneration of client SDK.
There was a problem hiding this comment.
Additional option is better then option in Configuration.mustache
Because no necessary for an user to set up it because it will be common behavior for all requests
no, I think it is necessary for a small number of users (one more reason for using Additional option)
In my opinion it is better to have an Additional option then have option in Configuration.mustache because it will be like “excessive option in Configuration.mustache”
but If for you better option in Configuration.mustache you can say and I’ll rewrite it
What do you think?
@ybelenko
There was a problem hiding this comment.
@wing328 As far as I remember you also against adding dozens of options to codegen. In current situation I think Configuration php class is better place to put this option.
@ksvirkou-hubspot Your suggested codegen option changes one single line of code, I understand that it's convinient to you, but client SDK users always ask to consider their use case as one and only important. 😅
There was a problem hiding this comment.
Ok
it was only thought
waiting decision and will do it
merge master
merge master
merge master
|
@ksvirkou-hubspot I don't clearly remember did you add that fix in #12120 or not. You should rebase to latest master and solve conflicts if you need this merged. |
# Conflicts: # modules/openapi-generator/src/main/resources/php/ObjectSerializer.mustache # samples/client/petstore/php/OpenAPIClient-php/lib/ObjectSerializer.php # samples/client/petstore/php/OpenAPIClient-php/tests/ObjectSerializerTest.php
I ve merged master |
|
As I said I would vote against codegen option in favour to config option. I think you can wait for somebody who share your vision to approve. Otherwise you can rewrite it a bit to use config option and I'll be pleased to merge. |
merge master
HI @ybelenko |
|
I would close this in favour of #12385 |
This PR creates an additional property "booleanFormatForQueryString"
User can choose the format for conversation of boolean to the query string
user can choose int (param=1 or param=0) or string (param=true or param=false)
int is default format because guzzle/psr7 converts boolean to int (param=1 or param=0)
it will fix #11683
PR checklist
This is important, as CI jobs will verify all generator outputs of your HEAD commit as it would merge with master.
These must match the expectations made by your contribution.
You may regenerate an individual generator by passing the relevant config(s) as an argument to the script, for example
./bin/generate-samples.sh bin/configs/java*.For Windows users, please run the script in Git BASH.
master(5.3.0),6.0.x