swaggerhub-cli icon indicating copy to clipboard operation
swaggerhub-cli copied to clipboard

The api:validate subcommand doesn't work from a bash script in an Azure DevOps pipeline

Open edugarias opened this issue 3 years ago • 0 comments

  • CLI version: 0.6.1
  • OS: Linux (Ubuntu 20.04)
  • Node.js version: 16.x
  • SwaggerHub version if On-Premise: 1.29.1-89

Describe the bug you're encountering

When trying to validate an API from a bash task in an Azure DevOps deployment pipeline using the following command: swaggerhub api:validate {SWAGGERHUB_ORGANIZATION}/{API_NAME}/{API_VERSION}

It fails with this output error: Error: request to https://{SERVER}/v1/apis/{OWNER}/{API}/{VERSION}/validation failed, reason: Parse Error: Invalid header value char

Note: the above command fails even when a direct call to the validation operation from the same pipeline via curl using the same parameters works correctly.

To reproduce...

Steps to reproduce the behavior:

  1. Given A deployment pipeline in Azure DevOps Services (Microsoft-hosted agent) using an Ubuntu virtual machine image An on-premise (reachable) instance of SwaggerHub that has API Standardization enabled An API specification to be validated A bash script to run the API validation command from the pipeline

  2. Execute command 'swaggerhub api:validate {SWAGGERHUB_ORGANIZATION}/{API_NAME}/{API_VERSION}'

  3. See error Error: request to https://SERVER/v1/apis/OWNER/API/VERSION/validation failed, reason: Parse Error: Invalid header value char

Expected behavior

The command should validate the API and print the relevant validation messages as output.

edugarias avatar May 31 '22 06:05 edugarias