Most files in the project are autogenerated by openapi-generator for php.
- template - folder contains redefined templates of
openapi-generator. Original templates you can find in openapi-generator repo. - docs - generated documentation for models and API Client.
- src - API Client code and generated models.
You need openapi-generator to run code generation. There are many ways described in the readme.
In the project we use Docker image openapitools/openapi-generator-cli for code generation.
You can just run sh ./scripts/generate.sh script and it will do all the work.
To download fresh OpenAPI schema run sh ./scripts/sync.sh
The generation script cleans fully managed output (src, docs, README.md, and composer.json) before running openapi-generator. It intentionally preserves test, because PHP test files generated by OpenAPI Generator are scaffolding: they are created when missing, but existing test files are not overwritten on later generation runs.
For the same reason, .openapi-generator/FILES tracks files written by the latest generation run, not every generated-looking file that exists in the repository.
To generate a code coverage report, follow these steps:
-
Run PHPUnit to generate a coverage report:
docker-compose run phpunit
- The Clover XML report will be saved in
cov/xml/clover.xml. - The HTML report will be saved in the
cov/htmldirectory.
- The Clover XML report will be saved in
-
To convert the Clover XML report into a markdown report, run the generate_coverage_report.php script:
docker-compose run php php generate_coverage_report.php
The markdown report will be saved in the cov/markdown/coverage_report.md file. You can open this file to review the coverage details.
Use the run_checks.php file to make API requests using the local version of the SDK.
- Make sure you have
phpinstalled. - Make sure you have
composerinstalled. - Run
composer installto install dependencies. - Create an
.envfile in the root folder according to .env.example with your API key and test variables. - Finally, run
php run_checks.php.
As an alternative to running the SDK tests locally, you can use Docker:
- Ensure that Docker is installed and running on your machine.
- Create an
.envfile in the root folder according to .env.example with your API key and test variables. - Run the following command to install dependencies using Docker:
docker-compose run composer install
- Run the following command to execute the SDK tests using Docker:
docker-compose run php php run_checks.php
Project configuration is described in the config.json file. To read about available parameters run the command below:
docker run --rm openapitools/openapi-generator-cli:v7.21.0 config-help -g phpWe use changesets for handling release notes. If there are relevant changes, please add them to changeset via pnpm exec changeset. You need to run pnpm install before doing so.