-
Notifications
You must be signed in to change notification settings - Fork 62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for Distribution path mapping with AQL #1031
Conversation
YardenEdery
commented
Nov 14, 2023
•
edited
Loading
edited
- All tests passed. If this feature is not already covered by the tests, I added new tests.
- All static analysis checks passed.
- This pull request is on the dev branch.
- I used gofmt for formatting the code before submitting the pull request.
CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅ |
I have read the CLA Document and I hereby sign the CLA |
1 similar comment
I have read the CLA Document and I hereby sign the CLA |
recheck |
Not sure about adding tests here, there are none related to distribution |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's add a complete description for this PR.
common/spec/specfiles.go
Outdated
@@ -194,6 +197,9 @@ func ValidateSpec(files []File, isTargetMandatory, isSearchBasedSpec bool) error | |||
isBypassArchiveInspection, _ := file.IsBypassArchiveInspection(false) | |||
isTransitive, _ := file.IsTransitive(false) | |||
|
|||
if isPathMapping && !isAql { | |||
return errorutils.CheckErrorf("mappings supported only with Aql") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mappings supported only with Aql
-->
path mapping is supported only with Aql
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you sure because "mappings" is the interface to the user, they will use "mappings" in their spec.json and I saw in the code you treat it as PathMappings so I kept the same conventions, and thought that the error should show the user what he needs to fix.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK. NP.
common/spec/specfiles.go
Outdated
if isPathMapping && isTarget { | ||
return fileSpecValidationError("mappings", "target") | ||
} | ||
if isPathMapping && isPattern { | ||
return fileSpecValidationError("mappings", "pattern") | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's place the above line right after the following code for better readability -
if isPathMapping && !isAql {
return errorutils.CheckErrorf("mappings supported only with Aql")
}
common/spec/specfiles.go
Outdated
@@ -41,6 +41,7 @@ func CreateSpecFromFile(specFilePath string, specVars map[string]string) (spec * | |||
|
|||
type File struct { | |||
Aql utils.Aql | |||
PathMapping utils.PathMapping `json:"mappings,omitempty"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we leave it "pathMapping"? Or use "mapping"?
PathMapping utils.PathMapping `json:"mappings,omitempty"` | |
PathMapping utils.PathMapping |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Let's fix the static code analysis before merging the code