Axway-API-Management-Plus / apim-cli

Axway API-Management CLI - Manage your platform from the command line or with your CI/CD pipeline
Apache License 2.0
46 stars 17 forks source link

Issues exporting and importing an API #460

Closed emmanuel-galindo closed 8 months ago

emmanuel-galindo commented 8 months ago

APIM-CLI version

1.14.2

API-Management version

7.7.20231130

Bug description

We are exporting an API, and then importing it back again. And we are getting strange behaviors: 1) it detects a change in the apiDefinition file 2) it creates a new API without the -force 3) it marks it as a non-breaking, and breaking with a difference of a couple of lines

Our desired behavior would be 1) as we are not changing anything, it should report the usual "no changes detected between desired and actual" 2) we want to avoid by all means APIs to be recreated (we rely on existing API ids for several purposes, and we want to keep the created date value) 3) we want to be reassured that not introducing force doesn't lead to applying breaking changes.

Log is showing: "INFO : Is Breaking changes : false Enforce Breaking changes : false"

and then: "DEBUG: Apply breaking changes: [apiDefinition] & and Non-Breaking: [], for UNPUBLISHED"

more lines: 2024-03-07 15:32:02,989 [APIImportManager] INFO : Recognized the following changes. Potentially Breaking: [apiDefinition] plus Non-Breaking: [] 2024-03-07 15:32:02,990 [APIImportManager] INFO : Is Breaking changes : false Enforce Breaking changes : false 2024-03-07 15:32:02,990 [APIImportManager] INFO : Update API Strategy: Re-Create API as changes can't be applied to existing API. 2024-03-07 15:32:02,990 [APIImportManager] DEBUG: Apply breaking changes: [apiDefinition] & and Non-Breaking: [], for UNPUBLISHED 2024-03-07 15:32:02,991 [RecreateToUpdateAPI] INFO : Create new API to update existing: Test - OAS3 (ID: 3c13181e-4e84-4a74-95f3-48d67103d0aa)

Steps to reproduce

I am going to share with you on a private email the .dat export for you to export/import ; and the complete debug

commands executed: $ apim api get -h localhost -u apiadmin -p changeme3 -id 3c13181e-4e84-4a74-95f3-48d67103d0aa -o json $ apim api import -h localhost -u apiadmin -p changeme3 -c .\testoas3error\api-config.json -a '.\testoas3error\Test - OAS3.json'

Relevant log output

sensible information, so sent via private email
rathnapandi commented 8 months ago

Hi @emmanuel-galindo Use axway-apimcli-1.14.4-SNAPSHOT.zip to test the fix.