Skip to content

Latest commit

 

History

History
74 lines (50 loc) · 3.04 KB

contributing.md

File metadata and controls

74 lines (50 loc) · 3.04 KB

Contributing to Fingerprint Pro Server API SDK

Structure

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.

Code generation

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

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:

java -jar ./bin/swagger-codegen-cli.jar config-help -l 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.