Most files in the project are autogenerated by swagger-codegen for php.
- template - folder contains redefined templates of
swagger-codegen
. Original templates you can find in swagger-codegen repo. - docs - generated documentation for models and API Client.
- src - API Client code and generated models.
You need swagger-codegen
to run code generation. There are many ways described in the readme.
In the project we use local jar file bin/swagger-codegen-cli.jar
.
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
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/html
directory.
- 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
php
installed. - Make sure you have
composer
installed. - Run
composer install
to install dependencies. - Create an
.env
file 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
.env
file 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:
java -jar ./bin/swagger-codegen-cli.jar config-help -l php
We 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.