@@ -39,7 +39,7 @@ func swiftTypeReference(for type: GraphQLType, includeNamespace: Bool, nameGener
3939 return " (any \( baseName) )? "
4040 }
4141 if let scalarType = namedType as? GraphQLScalarType {
42- let swiftScalar = mapScalarType ( scalarType, includeNamespace : includeNamespace , nameGenerator: nameGenerator)
42+ let swiftScalar = mapScalarType ( scalarType, nameGenerator: nameGenerator)
4343 return " \( swiftScalar) ? "
4444 }
4545 return " \( baseName) ? "
@@ -81,7 +81,7 @@ func swiftTypeDeclaration(for type: GraphQLType, includeNamespace: Bool, nameGen
8181/// - graphQLType: The GraphQL Type to generate a reference to
8282/// - includeNamespace: Whether to include the `GraphQLGenerated` type namespace in the result
8383/// - nameGenerator: The name generator
84- func mapScalarType( _ type: GraphQLScalarType , includeNamespace : Bool , nameGenerator: SafeNameGenerator ) -> String {
84+ func mapScalarType( _ type: GraphQLScalarType , nameGenerator: SafeNameGenerator ) -> String {
8585 switch type. name {
8686 case " ID " : return " String "
8787 case " String " : return " String "
@@ -94,37 +94,3 @@ func mapScalarType(_ type: GraphQLScalarType, includeNamespace: Bool, nameGenera
9494 return " GraphQLScalars. \( baseName) "
9595 }
9696}
97-
98- /// Converts a Map value to valid Swift code representation
99- func mapToSwiftCode( _ map: Map ) -> String {
100- switch map {
101- case . undefined:
102- return " .undefined "
103- case . null:
104- return " .null "
105- case let . bool( value) :
106- return " .bool( \( value) ) "
107- case let . number( value) :
108- return " .number(Number( \( value) )) "
109- case let . string( value) :
110- // Escape special characters for Swift string literal
111- let escaped = value
112- . replacingOccurrences ( of: " \\ " , with: " \\ \\ " )
113- . replacingOccurrences ( of: " \" " , with: " \\ \" " )
114- . replacingOccurrences ( of: " \n " , with: " \\ n " )
115- . replacingOccurrences ( of: " \r " , with: " \\ r " )
116- . replacingOccurrences ( of: " \t " , with: " \\ t " )
117- return " .string( \" \( escaped) \" ) "
118- case let . array( values) :
119- let elements = values. map { mapToSwiftCode ( $0) } . joined ( separator: " , " )
120- return " .array([ \( elements) ]) "
121- case let . dictionary( dict) :
122- let pairs = dict. map { key, value in
123- let escapedKey = key
124- . replacingOccurrences ( of: " \\ " , with: " \\ \\ " )
125- . replacingOccurrences ( of: " \" " , with: " \\ \" " )
126- return " \" \( escapedKey) \" : \( mapToSwiftCode ( value) ) "
127- } . joined ( separator: " , " )
128- return " .dictionary([ \( pairs) ]) "
129- }
130- }
0 commit comments