openapi-generator/samples/server/petstore/php-ze-ph
William Cheng 8c599ebf12
Add support for multiple inheritance (#1664)
* add all parent names

* clean up supportsInheritance

* fix npe

* fix allVars, fix test cases

* add more tests, remove comments

* update docker m2 cache dir, add more tests, fix mandatory

* update samples

* regenerate js spec files

* add logic to detect self reference

* add isSelfReference flag to codegen property

* add ruby tests for cat model

* remove debugging info

* fix JS allvars not have x-js-doctype

* update samples

* update js samples
2018-12-15 00:24:36 +08:00
..
.openapi-generator Prepare v3.3.3-SNAPSHOT (#1355) 2018-11-01 10:42:26 +08:00
application [Golang][client] fix for schema definition name file (#433) 2018-07-05 20:32:24 +08:00
public [PHP] Adjust the names (script, sample folder, generator) to lang option (#159) 2018-05-28 13:49:47 +08:00
src/App Add support for multiple inheritance (#1664) 2018-12-15 00:24:36 +08:00
.gitignore [PHP] Add gitignore to AbstractPhpCodegen (#765) 2018-08-20 12:16:01 +08:00
.openapi-generator-ignore [PHP] Adjust the names (script, sample folder, generator) to lang option (#159) 2018-05-28 13:49:47 +08:00
composer.json [PHP] Adjust the names (script, sample folder, generator) to lang option (#159) 2018-05-28 13:49:47 +08:00
README.md [PHP] Adjust the names (script, sample folder, generator) to lang option (#159) 2018-05-28 13:49:47 +08:00

OpenAPI generated server

Generated by the OpenAPI Generator project.

Overview

This server stub aims to provide light, yet comprehensive structure for your API project using:

How to use

All you have to do to start development is:

  • install dependencies via Composer
  • create cache folder: mkdir -p ./data/cache/ZendCache (you will need it later for configuration and metadata caches - check comments in ./application/config.yml)
  • start PHP development server: php -S 0.0.0.0:8080 -t ./public (or any other SAPI you prefer, just make sure that you configure webroot to ./public and rewrites to ./public/index.php)

After that you should be able to call all methods from your API spec. Most of the negative scenarios should be handled:

  • 404 Not found for unknown routes
  • 406 Not acceptable for invalid Accept header
  • 415 Unsupported media type for invalid Content-Type header
  • 400 Malformed JSON for unparsable JSON body
  • 422 Unprocessable entity for parsable JSON body that fails validation

But for obvious reason you will not get any 200 OK, only 500 Not implemented. So your next steps are:

  • check all TODOs left in the stub code where generator was not smart enough and could not guarantee correct implementation
  • implement your API security mechanism (either special attribute or separate middleware) - generator does not do anything about it yet
  • implement your handlers - the most tricky part :)

Enjoy!

Hopefully this stub will reduce the amount of boilerplate code you have to write manually. If you have any suggestions or questions about ze-ph generator, feel free to create issue either in Path Handler repository or in OpenAPI Generator repository.