MCPcopy
hub / github.com/dosco/graphjin / jsonMarshalServiceSDL

Function jsonMarshalServiceSDL

core/federation.go:337–343  ·  view source on GitHub ↗

jsonMarshalServiceSDL produces the response payload Apollo expects: `{"_service":{"sdl":"..."}}`. The outer envelope is added by the engine's response wrapper.

(sdl string)

Source from the content-addressed store, hash-verified

335// `{"_service":{"sdl":"..."}}`. The outer envelope is added by the
336// engine's response wrapper.
337func jsonMarshalServiceSDL(sdl string) ([]byte, error) {
338 var b strings.Builder
339 b.WriteString(`{"_service":{"sdl":`)
340 b.WriteString(strconv.Quote(sdl))
341 b.WriteString(`}}`)
342 return []byte(b.String()), nil
343}
344
345// bytesContainsToken reports whether `tok` appears as a standalone
346// identifier in `s` (no alphanumeric or underscore on either side).

Callers 2

handleFederationQueryMethod · 0.85

Calls 3

WriteStringMethod · 0.65
QuoteMethod · 0.65
StringMethod · 0.45

Tested by 1