refactor(mcp): remove unused registry iterator helper
Keeps the registry surface tighter by removing the unused splitTagSeq helper and updating the test to cover the production splitTag helper directly. Co-Authored-By: Virgil <virgil@lethean.io>
This commit is contained in:
parent
bfb5bf84e2
commit
7b22fd3141
2 changed files with 2 additions and 16 deletions
|
|
@ -29,9 +29,9 @@ func TestService_Iterators(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func TestRegistry_SplitTagSeq(t *testing.T) {
|
||||
func TestRegistry_SplitTag(t *testing.T) {
|
||||
tag := "name,omitempty,json"
|
||||
parts := slices.Collect(splitTagSeq(tag))
|
||||
parts := splitTag(tag)
|
||||
expected := []string{"name", "omitempty", "json"}
|
||||
|
||||
if !slices.Equal(parts, expected) {
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ package mcp
|
|||
|
||||
import (
|
||||
"context"
|
||||
"iter"
|
||||
"reflect"
|
||||
|
||||
core "dappco.re/go/core"
|
||||
|
|
@ -134,19 +133,6 @@ func splitTag(tag string) []string {
|
|||
return core.Split(tag, ",")
|
||||
}
|
||||
|
||||
// splitTagSeq returns an iterator over the tag parts.
|
||||
func splitTagSeq(tag string) iter.Seq[string] {
|
||||
// core.Split returns []string; wrap as iterator
|
||||
parts := core.Split(tag, ",")
|
||||
return func(yield func(string) bool) {
|
||||
for _, p := range parts {
|
||||
if !yield(p) {
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// goTypeToJSONType maps Go types to JSON Schema types.
|
||||
func goTypeToJSONType(t reflect.Type) string {
|
||||
switch t.Kind() {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue