MCPcopy Index your code
hub / github.com/github/github-mcp-server / githubv4InputStructToMap

Function githubv4InputStructToMap

internal/githubv4mock/githubv4mock.go:96–105  ·  view source on GitHub ↗

githubv4InputStructToMap converts a struct to a map[string]any, it uses JSON marshalling rather than reflection to do so, because the json struct tags are used in the real implementation to produce the variable key names, and we need to ensure that when variable matching occurs in the http handler,

(s any)

Source from the content-addressed store, hash-verified

94// to do so, because the json struct tags are used in the real implementation to produce the variable key names,
95// and we need to ensure that when variable matching occurs in the http handler, the keys correctly match.
96func githubv4InputStructToMap(s any) (map[string]any, error) {
97 jsonBytes, err := json.Marshal(s)
98 if err != nil {
99 return nil, err
100 }
101
102 var result map[string]any
103 err = json.Unmarshal(jsonBytes, &result)
104 return result, err
105}
106
107// NewMockedHTTPClient creates a new HTTP client that registers a handler for /graphql POST requests.
108// For each request, an attempt will be be made to match the request body against the provided matchers.

Callers 1

NewMutationMatcherFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected