Skip to content

Latest commit

 

History

History
79 lines (53 loc) · 3.6 KB

File metadata and controls

79 lines (53 loc) · 3.6 KB

Contributing to Fingerprint Server PHP SDK

Structure

Most files in the project are autogenerated by openapi-generator for php.

Code generation

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

Auto-generated test files and FILES manifest

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.

Creating Coverage Report (Markdown and HTML)

To generate a code coverage report, follow these steps:

  1. 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.
  2. 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.

Testing the local source code of the SDK

Use the run_checks.php file to make API requests using the local version of the SDK.

  1. Make sure you have php installed.
  2. Make sure you have composer installed.
  3. Run composer install to install dependencies.
  4. Create an .env file in the root folder according to .env.example with your API key and test variables.
  5. Finally, run php run_checks.php.

Testing the local source code of the SDK (Docker)

As an alternative to running the SDK tests locally, you can use Docker:

  1. Ensure that Docker is installed and running on your machine.
  2. Create an .env file in the root folder according to .env.example with your API key and test variables.
  3. Run the following command to install dependencies using Docker:
    docker-compose run composer install
  4. Run the following command to execute the SDK tests using Docker:
    docker-compose run php php run_checks.php

Configuration

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 php

How to publish

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.