pub fn escape_graphql_sdl_description(
s: &str,
_context: EscapeContext,
) -> StringExpand description
Escape a string for use in GraphQL SDL (Schema Definition Language) descriptions.
GraphQL SDL uses triple-quoted strings for descriptions, similar to Python. However, the escape rules are different - we need to escape triple quotes with backslashes.
§Arguments
s- The string to escapecontext- The target language context (mostly for consistency in codegen)
§Returns
A string escaped for safe embedding in GraphQL SDL descriptions
§Examples
use spikard_cli::codegen::common::escaping::{EscapeContext, escape_graphql_sdl_description};
// GraphQL SDL descriptions use triple quotes
let result = escape_graphql_sdl_description("Has \"\"\" in description", EscapeContext::Python);
assert!(result.contains("\\\\\\\""));