-
-
Notifications
You must be signed in to change notification settings - Fork 6.4k
New issue
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
[PHP] Decommission "packagePath", add new option "packageName" #681
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've used getPackagePath
method in
Lines 113 to 120 in 926b971
supportingFiles.add(new SupportingFile("README.mustache", getPackagePath(), "README.md")); | |
supportingFiles.add(new SupportingFile("composer.mustache", getPackagePath(), "composer.json")); | |
supportingFiles.add(new SupportingFile("index.mustache", getPackagePath(), "index.php")); | |
supportingFiles.add(new SupportingFile(".htaccess", getPackagePath(), ".htaccess")); | |
supportingFiles.add(new SupportingFile(".gitignore", getPackagePath(), ".gitignore")); | |
supportingFiles.add(new SupportingFile("AbstractApiController.mustache", toSrcPath(invokerPackage, srcBasePath), "AbstractApiController.php")); | |
supportingFiles.add(new SupportingFile("SlimRouter.mustache", toSrcPath(invokerPackage, srcBasePath), "SlimRouter.php")); | |
supportingFiles.add(new SupportingFile("phpunit.xml.mustache", getPackagePath(), "phpunit.xml.dist")); |
You should change it too to keep all codegens consistent.
@ybelenko what about keeping getPackagePath() or packagePath in all PHP server generators and put the following in the constructor instead?
so that the package path (root folder) can be changed easily by the users if they need to customize it somehow? |
@wing328 It was my first approuch. I don't have full knowledge of your path generation, but this way I can generate code in a specific folder. I think we need to ask @ackintosh about that. |
@ybelenko sure let's wait for @ackintosh to review. Btw, the following approach is already used in other PHP server generators:
|
I think It sets the destination to root folder as default and be able to change if user want. |
@ackintosh thanks for the feedback. I'll change the rest accordingly. |
@ybelenko @ackintosh I've decommissioned packagePath and add a new option "packageName". The samples are exactly the same as before. Please review when you've time. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Found a -o
target which should be fixed. 👀
samples/server/petstore/php-silex -> samples/server/petstore/php-silex/OpenAPIServer
@ackintosh good catch. Fixed via 0d45184 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me. 👍
@ybelenko can you merge it if it looks good to you? Thanks |
Now I don't understand what we need The only reason I can imagine for /**
* FakeApi Class Doc Comment
* PHP Version 5
*
* @category Class
* @package GeneratedPetstore
* @author OpenAPI Generator team
*/
class FakeApi { Do we keep
If I understand this description correct, then mustache should look like: class {{packageName}}{{classname}} and result: class GeneratedPetstoreFakeApi In total |
The {{packageName}} is used in the README: https://github.com/OpenAPITools/openapi-generator/pull/681/files#diff-5763a353c6e95ff8967e09ce0e52ba53R1 |
Upgrade NoteThe To specify the package name in the auto-generated README.md, please use the new option |
Seems like issue OpenAPITools#663 and pull request OpenAPITools#681 missed this security script, I've changed output path in bin/security/silex-petstore-server.sh.
* [PHP] Remove PHP related rules from root gitignore After conversation with @ackintosh we've agreed that every PHP codegen should create it's own `.gitignore`. Client libraries(SDKs) should ignore `composer.lock` file while server stubs better do opposite. * [PHP] Set .gitignore as default supporting file * [PHP] Add default gitignore to Client SDK * [PHP] Add default gitignore to Laravel * [PHP] Add default gitignore to Lumen * [PHP] Add default gitignore to Silex Seems like issue #663 and pull request #681 missed this security script, I've changed output path in bin/security/silex-petstore-server.sh. * [PHP] Update Slim * [PHP] Add default gitignore to Symfony I've copied few old rules from root gitignore to local one. These rules should be reviewed by original SymfonyCodegen authors. * [PHP] Add default gitignore to Zend * [PHP] Refresh Openapi3 client samples * [PHP] Add refs to .gitignore templates collection
…PITools#681) * remove packagePath from php file location, use -o instead * fix php symfony top folder * restore pacakgePath * update php laraavel samples * remove packagePath from PHP generator * add new silex files * update window batch - php silex * fix openapi3 silex script
* [PHP] Remove PHP related rules from root gitignore After conversation with @ackintosh we've agreed that every PHP codegen should create it's own `.gitignore`. Client libraries(SDKs) should ignore `composer.lock` file while server stubs better do opposite. * [PHP] Set .gitignore as default supporting file * [PHP] Add default gitignore to Client SDK * [PHP] Add default gitignore to Laravel * [PHP] Add default gitignore to Lumen * [PHP] Add default gitignore to Silex Seems like issue OpenAPITools#663 and pull request OpenAPITools#681 missed this security script, I've changed output path in bin/security/silex-petstore-server.sh. * [PHP] Update Slim * [PHP] Add default gitignore to Symfony I've copied few old rules from root gitignore to local one. These rules should be reviewed by original SymfonyCodegen authors. * [PHP] Add default gitignore to Zend * [PHP] Refresh Openapi3 client samples * [PHP] Add refs to .gitignore templates collection
PR checklist
./bin/
to update Petstore sample so that CIs can verify the change. (For instance, only need to run./bin/{LANG}-petstore.sh
and./bin/security/{LANG}-petstore.sh
if updating the {LANG} (e.g. php, ruby, python, etc) code generator or {LANG} client's mustache templates). Windows batch files can be found in.\bin\windows\
.master
,4.0.x
. Default:master
.Description of the PR
To close #663
cc @jebentier (2017/07) @dkarlovi (2017/07) @mandrean (2017/08) @jfastnacht (2017/09) @ackintosh (2017/09) @ybelenko (2018/07)