[BUG] Extractor - API specification.json file is overwritten by last API in extractor config
See original GitHub issueRelease 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
- Create an API versionset with 2 API versions.
- Configure extractor to extract both of those APIs.
- Run the extractor once, merge PR.
- Run the extractor again and view (incorrect) PR.
Issue Analytics
- State:
- Created 3 months ago
- Comments:11 (6 by maintainers)
Top GitHub Comments
@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 notrevisions
, you’re correct; APIM treats APIs in the same version set as distinct APIs. In your example, you’ll need to specify bothapiA
andapiA-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:
Create apiA
Add v2 We now have two APIs,
Original
andv2
.Run extractor. We see the version set…
…and the APIs.
ApiA
Note the incorrect references to V2.
ApiA-V2
apiA
.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.