Skip to content

GraphQL parser does not seem to have support for the '&' character #67

Closed
@haikusw

Description

@haikusw

This is discussed in the graphql specification here.

I noticed when using the GitHub API to test the changes I made for blockstring and descriptions. This API uses these quite a bit. Here's a little test I wrote to show the issue:

import XCTest
import GraphQL

final class graphQLTests: XCTestCase {
  func testParseAmpersand() throws {
    let source = #"""
    """
    Represents a Git blob.
    """
    type Blob implements Node & GitObject {
      """
      An abbreviated version of the Git object ID
      """
      abbreviatedOid: String!

      """
      Byte size of Blob object
      """
      byteSize: Int!

      # other fields omitted
    }
    """#
    let doc = try parse(instrumentation: NoOpInstrumentation, source: Source(body: source))
    for def in doc.definitions {
    print( def.kind )
    }
  }
}

Outputs the error:

/Users/.../graphqltoolTests.swift:46: error: -[testParseAmpersand] : failed: caught error: "Syntax Error GraphQL (4:27) Unexpected character &.

 3: """
 4: type Blob implements Node & GitObject {
                              ^
 5:   """
"

I will likely try to add support for this, but I don't think I'll have time this week.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions