Skip to content

Latest commit

 

History

History
57 lines (35 loc) · 2.21 KB

contributing.md

File metadata and controls

57 lines (35 loc) · 2.21 KB

Contributing to Fingerprint Pro Server API Go SDK

Structure

Most files in the project are autogenerated by swagger-codegen.

  • 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.
  • sdk - API Client code - partialy generated by swagger.

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 swagger-codegen-cli.jar.

You can just run go run generate.go script and it will do all the work.

To download fresh OpenAPI schema run ./sync.sh.

Swagger generates models and API service interface for us, which we then implement manually. You can check ./sdk/api_fingerprint.go and ./sdk/api_fingerprint_impl.go for examples.

Configuration

Project configuration is described in config.json file. To read about available parameters run the command below:

java -jar ./bin/swagger-codegen-cli.jar config-help -l go

Running tests

Tests are located in tests.

To run tests you can use IDE instruments or just run:

cd test && go test

How to test the local version of the SDK

Go inside the example folder to test API requests using the local version of the SDK. The example/go.mod file reroutes the SDK module references inside example to its parent folder.

Create an .env file inside the example folder according to example.env.

Run the scripts like this:

cd example
go run getEvent.go
go run getVisits.go

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.