MCPcopy Create free account
hub / github.com/github/gh-aw / uniqueClosestScopeSuggestions

Function uniqueClosestScopeSuggestions

pkg/parser/schema_errors.go:417–437  ·  view source on GitHub ↗
(unknownProps []string, scopes []string)

Source from the content-addressed store, hash-verified

415}
416
417func uniqueClosestScopeSuggestions(unknownProps []string, scopes []string) []string {
418 var allSuggestions []string
419 for _, prop := range unknownProps {
420 prop = strings.TrimSpace(prop)
421 if prop == "" {
422 continue
423 }
424 allSuggestions = append(allSuggestions, FindClosestMatches(prop, scopes, maxClosestMatches)...)
425 }
426 seen := make(map[string]struct {
427 })
428 var unique []string
429 for _, s := range allSuggestions {
430 if !setutil.Contains(seen, s) {
431 seen[s] = struct {
432 }{}
433 unique = append(unique, s)
434 }
435 }
436 return unique
437}
438
439func appendKnownFieldDocsURL(result, docsURL string) string {
440 if docsURL == "" {

Callers 1

Calls 2

ContainsFunction · 0.92
FindClosestMatchesFunction · 0.70

Tested by

no test coverage detected