Skip to content

Conversation

@ybelenko
Copy link
Contributor

@ybelenko ybelenko commented Jul 2, 2018

PR checklist

  • Read the contribution guidelines.
  • Ran the shell script under ./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\.
  • Filed the PR against the correct branch: master, 3.1.x, 4.0.x. Default: master.
  • Copied the technical committee to review the pull request if your PR is targeting a particular programming language.

Description of the PR

Logical prepare before unit test generation feature.
Now generated package splitted into ApiControllers, Models and SlimRouter. This provides simple approach for unit testing and code coverage.
Samples omitted in first commit to simplify code review.

cc @jebentier @dkarlovi @mandrean @jfastnacht @ackintosh

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+        apiPackage = invokerPackage + "\\" + apiDirName;
+        modelPackage = invokerPackage + "\\" + modelDirName;

As the method name setInvokerPackage() implies, it should set only invokerPackage. 💡

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ybelenko added 2 commits July 5, 2018 22:48
This enhancement required for modular testing and code coverage generating.
@ybelenko ybelenko force-pushed the slim_enhancement_decouple branch from 81b5bc3 to b7addcd Compare July 5, 2018 17:53
@ybelenko
Copy link
Contributor Author

ybelenko commented Jul 5, 2018

Fixed. setInvokerPackage overriden method deleted.
I will try to solve Composer autoload issue in next PRs, for now user can set wrong values(when modelPackage and apiPackage doesn't start with invokerPackage Composer autoloader is broken). Maybe we can just throw a warning to user instead of fixing them when provided values are incorrect.

Copy link
Contributor

@ackintosh ackintosh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fix. Looks good to me.

@ybelenko
Copy link
Contributor Author

ybelenko commented Jul 6, 2018

Upgrade note

Current refactoring brings breaking changes. If your application stop working you need to copypaste endpoints implementation from index.php to corresponding ApiControllers(OpenAPIServer\Api\FakeApi class for instance). That simple code relocation should fix your app.

@wing328
Copy link
Member

wing328 commented Jul 6, 2018

The Shippable failure has been addressed in the master.

@wing328 wing328 added this to the 3.1.0 milestone Jul 6, 2018
@wing328 wing328 merged commit 9eeeded into OpenAPITools:master Jul 6, 2018
@ybelenko ybelenko deleted the slim_enhancement_decouple branch July 6, 2018 06:38
jimschubert added a commit to jimschubert/openapi-generator that referenced this pull request Jul 7, 2018
* master: (116 commits)
  3.1.0 release (OpenAPITools#486)
  Fix broken link to openapi generator plugin README (OpenAPITools#484)
  show warning message for nodejs server only (OpenAPITools#481)
  Add grokify to Go technical committee (OpenAPITools#479)
  [Slim] Improve codebase decouple (OpenAPITools#438)
  Ensure typescript samples are up to date (OpenAPITools#444)
  Update README.md
  [Golang][client] delete sample output dir before rebuild (OpenAPITools#477)
  update petstore samples (OpenAPITools#478)
  Revert "Improve Docker Tags (OpenAPITools#390)"
  update go client test dependencies (OpenAPITools#468)
  [Golang][client] fix for schema definition name `file` (OpenAPITools#433)
  Fix '.travis' file (syntax)
  make LICENSE GitHub display compatible (OpenAPITools#467)
  Improve Docker Tags (OpenAPITools#390)
  [Golang][client] fix file suffix for _test.go (OpenAPITools#449)
  Remove copy section (OpenAPITools#463)
  Add link to presentation (OpenAPITools#465)
  Use postProcessOperationsWithModels(Map, List) (OpenAPITools#431)
  [C] Adding petstore sample written in C (OpenAPITools#306)
  ...
A-Joshi pushed a commit to ihsmarkitoss/openapi-generator that referenced this pull request Feb 27, 2019
* [Slim] Decouple Api files into separated PHP Classes

This enhancement required for modular testing and code coverage generating.

* [Slim] Define all app routes in SlimRouter PHP Class. Generate new samples
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants