Repository navigation
Conversation
Signed-off-by: Lalit Kishore <lr_be24@thapar.edu>
|
Welcome to the Microcks community! 💖 Thanks and congrats 🎉 for opening your first pull request here! Be sure to follow the pull request template or please update it accordingly. Hope you have a great time there! |
Vaishnav88sk
suggested changes
Oct 6, 2026
Comment on lines
+215
to
+218
| // Secondary artifacts can only enrich API definitions that already exist. | ||
| sort.SliceStable(files, func(i, j int) bool { | ||
| return detectFileType(files[i]).IsPrimary && !detectFileType(files[j]).IsPrimary | ||
| }) |
Contributor
There was a problem hiding this comment.
Avoid sorting overhead. Its TC is in O(nlogn)..
A strict 2 slice partition will be better.
var primary, secondary []string
for _, f := range files {
// primary and secondary classification
}
orderedFiles := append(primary, secondary...)
// proceed with upload loop over orderedFiles...Signed-off-by: Lalit Kishore <lr_be24@thapar.edu>
This branch has not been deployed
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.
Fixes #561.
import-dircurrently uploadsexamples.yamlbeforeopenapi.yamlbecause it follows filesystem discovery order. On a first import, a secondary artifact can arrive before its API exists and be ignored. This change uploads detected primary artifacts first, preserving discovery order within each group.Regression tests cover flat and recursive directories, stable ordering, primary-only and secondary-only imports, filtering, and upload-failure accounting. Four cases fail before the fix; all six pass after it. Tests use the real filesystem and a recording upload client; no live Microcks server was used.
Validation:
go test ./...go test -race ./cmd -run 'TestImportDirectory' -count=1go build ./...go vet ./...git diff --checkAI disclosure: ChatGPT was used to help implement the fix, write regression tests, and review and double-check the changes.