Files
azuredatastudio/extensions/arc/src/controller
Brian Bergeron 283ffd7af6 Azure Arc extension (#10400)
Adds an extension for Azure Arc with some initial Postgres pages
2020-05-18 14:32:48 -07:00
..
2020-05-18 14:32:48 -07:00
2020-05-18 14:32:48 -07:00
2020-05-18 14:32:48 -07:00

Updating the Swagger generated clients

The TypeScript clients used to communicate with the controller are generated from the controller's Swagger specification. To update the clients:

  1. Get the Swagger specification from a running controller, and save it locally:

    • https://<controller_ip>:30080/api/<api_name>/swagger.json
  2. Generate the clients:

    • At the time of writing, editor.swagger.io does not support typescript-node client generation from OpenAPI 3.x specifications. So we'll use openapi-generator.tech instead.

    • Run openapi-generator:

      • Either by installing it (requires Java) and running:

        • openapi-generator generate -i swagger.json -g typescript-node -o out --additional-properties supportsES6=true
      • Or by running the Docker image (works in Linux or PowerShell):

        • docker run --rm -v ${PWD}:/local openapitools/openapi-generator-cli generate -i /local/swagger.json -g typescript-node -o /local/out --additional-properties supportsES6=true
  3. Copy the generated clients (api.ts, api/, model/) to ./generated/<api_name>.

  4. The generated clients have some unused imports. This will not compile. VS Code has an "Organize Imports" command (Shift + Alt + O) that fixes this, but it fixes a single file. To organize imports for all files in a folder, you can use the Folder Source Actions extension. Followed by File -> Save All.