Extractor mistakes set-body json response as transitive dependency which causes pipeline failure

Open
#349 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
56/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
azure, typescript
Domain
backend, cli

Research direction

Start by tracing the dependency extraction path used by apiops-cli extract and find where it interprets braces in policy content as transitive dependencies. Reproduce the failure with the provided set-body JSON response and inspect the related extraction tests. Done means extraction succeeds when this response contains {{ and }} and still handles genuine transitive dependencies.

Written by the indexing model from the issue text.

Description

type:bug
Command that triggered the bug

apiops-cli extract

Expected behavior

When extracting an API the extractor should not fail when it can not resolve a transitive dependency.

Actual behavior

When extraction an API the following set-body json response is being mistaken as a transitive dependency due to the braces "{{" and "}}" in the return string.

<!--
      Fail if the auth endpoint returned a non-200
  -->
  <choose>
      <when condition="@(((IResponse)context.Variables["tokenResponseVar"]).StatusCode != 200)">
          <return-response>
              <set-status code="502" reason="Bad Gateway" />
              <set-header name="Content-Type" exists-action="override">
                  <value>application/json</value>
              </set-header>
              <set-body>@{
                  var status = ((IResponse)context.Variables["tokenResponseVar"]).StatusCode;
                  return $"{{\"error\":\"upstream_auth_failed\",\"upstream_status\":{status}}}";
              }</set-body>
          </return-response>
      </when>
  </choose>
image
apiops CLI version

1.0.5

Environment details

Azure DevOps

CI/CD environment

Azure DevOps

Is this bug blocking you?

Yes

Dominant language
TypeScript
Stars
44
Forks
14
PR merge metrics
No merged PRs in 30d

Getting set up

Open in Codespaces

Starts the project's dev container in your browser, under your own GitHub account.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from Azure/apiops-cli

All issues in Azure/apiops-cli

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.