Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
haikusw opened this issue Aug 26, 2020 · 2 comments
Closed

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

haikusw opened this issue Aug 26, 2020 · 2 comments

Comments

@haikusw
Copy link
Contributor

haikusw commented Aug 26, 2020

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.

@paulofaria
Copy link
Member

Yes, there are a lot of features that were added to the spec that we didn't implement yet. For example, allowing interfaces to inherit from other interfaces is also something that we need to update. Like I said in a previous comment, most of the work for any new feature supported upstream can be "sourced" directly from the canonical implementation. 🙂

@nicholaslythall
Copy link

Fixed in this PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants