question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[BUG] Extractor - API specification.json file is overwritten by last API in extractor config

See original GitHub issue

Release version

v4.3.0

Describe the bug

I have configured the extractor to extract both versions (apiA and apiA-v2) of a version set. The OpenAPI specs differ between these two API versions.

The first time I run the extractor, it creates a PR as expected with both unique specification files. I merged that PR and then – without changing anything in APIM – ran the extractor again.

This time, it creates a PR and overrides Artifacts/apis/apiA/specification.json file with the contents of Artifacts/apis/apiA-v2/specification.json file.

My extractor config looks like this:

apiNames:
- apiA
- apiA-v2

(apiA-v2 spec overwrites apiA spec)

As a test, I switched the order in extractor config, and I confirmed that the last API in the extractor config seems to override other API versions.

i.e. With this configuration, apiA spec overwrites apiA-v2 spec

apiNames:
- apiA-v2
- apiA

Expected behavior

The second run of extractor would not create a PR because nothing had changed. The APIs extracted would be independent.

Actual behavior

The second run results in a PR that overwrites apiA specification with apiB specification. The last listed API in extractor config “wins” and overwrites the other versions.

Reproduction Steps

  1. Create an API versionset with 2 API versions.
  2. Configure extractor to extract both of those APIs.
  3. Run the extractor once, merge PR.
  4. Run the extractor again and view (incorrect) PR.

Issue Analytics

  • State:open
  • Created 3 months ago
  • Comments:11 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
guythetechiecommented, Jul 18, 2023

@hscheffert - My bad, I was thinking about revisions instead of version sets. As @waelkdouh pointed out, we have a Wiki that talks about how version sets are handled.

Understanding now that you’re talking about version sets and not revisions, you’re correct; APIM treats APIs in the same version set as distinct APIs. In your example, you’ll need to specify both apiA and apiA-v2 for both to be extracted.

Back to your original issue: I am able to reproduce it. Adding it to our backlog. Reproduction steps below:

  1. Create apiA image

  2. Add v2 image We now have two APIs, Original and v2. image

  3. Run extractor. We see the version set… image

…and the APIs.

ApiA

Note the incorrect references to V2. image

ApiA-V2

image

  1. Rerunning the extractor creates a new PR that incorrectly sets both URLs to apiA. image
1reaction
waelkdouhcommented, Jul 5, 2023

As you probably know this is an open source project so we try your address existing issues when we get a chance. We will get to this at one point but at the moment we have other priorities within the project. So please be patient.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Issues · Azure/apiops
APIOps applies the concepts of GitOps and DevOps to API deployment. ... [BUG] Extractor - API specification.json file is overwritten by last API...
Read more >
[api-extractor] Unable to find a package.json file for the ...
json file starting in the same directory as the config file, then upwards, and does not look in the projectFolder specified in the...
Read more >
api-extractor.json
API Extractor's behavior is controlled by a config file api-extractor. json that is stored with your project. You can use the api-extractor init...
Read more >
Configuring a .d.ts rollup
To enable .d.ts rollup generation, you simply need to set dtsRollup.enabled to true in your api-extractor.json config file. By default, the rollup file...
Read more >
Invoking API Extractor
The simplest way to invoke API Extractor is via the command-line. 1. Configure the TypeScript compiler for your project​. For this tutorial, suppose...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found