Skip to content

Latest commit

 

History

History
22 lines (12 loc) · 934 Bytes

API_CLIENT.md

File metadata and controls

22 lines (12 loc) · 934 Bytes

API Client

Communication with the backend API is implemented through the client in ApiClient.ts. It's an autogenerated file that contains all required methods and types for work with API.

Auto-generation is done through the NSwag package which uses the open API documentation to generate typescript client code. NSwag is listed as a dev dependency in this project.

nswag.json contains required configuration.

Regeneration

After any changes to the API contract (new endpoints, URL changes, requests, or return types) ApiClient needs to be regenerated to reflect these changes.

  1. Start the API on your local machine *
  2. Ensure url /swagger is working properly
  3. Run command: node_modules/.bin/nswag run
  4. Check changes in ApiClinet.ts
  5. Fix all broken code dependencies on ApiClient

* you can specify exact location in nswag.json