Add dryRun property for API Import action#1261
Merged
AnuGayan merged 3 commits intowso2:masterfrom Feb 26, 2025
Merged
Conversation
npamudika
previously approved these changes
Feb 22, 2025
ashera96
previously approved these changes
Feb 22, 2025
pubudu538
reviewed
Feb 22, 2025
import-export-cli/impl/importAPI.go
Outdated
| var data JSONData | ||
| err := json.Unmarshal([]byte(resp.String()), &data) | ||
| if err != nil { | ||
| fmt.Println("Error parsing JSON:", err) |
Contributor
There was a problem hiding this comment.
Does err go to the tool execution level? If that is the case, I think we should print this entire error message in the verbose mode.
Contributor
Author
There was a problem hiding this comment.
this will get logged in the console, will add a single line error and print the stack trace in verbose mode
Krishanx92
approved these changes
Feb 26, 2025
npamudika
approved these changes
Feb 26, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces several enhancements and new features to the
import-export-clitool, including the addition of a dry-run mode for API imports and improved logging for policy violations. The most important changes include adding new flags for the dry-run mode, implementing a new JSON data structure for compliance checks, and updating the import API functions to support the new features.Enhancements to API Import Functionality:
dryRunandapiLoggingCmdFormatflags to theimportAPIcommand to support dry-run mode and specify the output format for violation results. (import-export-cli/cmd/importAPI.go[1] [2] [3]ImportAPIToEnvfunction to handle the new dry-run and logging format parameters. (import-export-cli/impl/importAPI.go[1] [2] [3]New Data Structures and Logging:
JSONData,ComplianceCheck, andViolationto represent compliance check results and violations in JSON format. (import-export-cli/impl/importAPI.goimport-export-cli/impl/importAPI.goR43-R53)PrintViolationsfunction to print policy violations in different formats (table, JSON, list) based on the specified logging format. (import-export-cli/impl/printPolicyViolations.goimport-export-cli/impl/printPolicyViolations.goR1-R97)Dependency Updates:
github.com/olekukonko/tablewriterandgithub.com/mattn/go-runewidthto support table formatting in the violation logging. (import-export-cli/go.mod[1] [2]Minor Code Improvements:
import-export-cli/git/gitUtils.go[1] [2] [3] [4]## PurposeFixes issue reported in wso2/api-manager#2341