nicolasdao / graphql-s2s

Add GraphQL Schema support for type inheritance, generic typing, metadata decoration. Transpile the enriched GraphQL string schema into the standard string schema understood by graphql.js and the Apollo server client.
Other
187 stars 15 forks source link

Leading comment causes transpilation error #15

Closed tmcnab closed 6 years ago

tmcnab commented 6 years ago

The leading comment in this type definition:

    # The most generic type of item. See also: schema.org/Thing
    type Thing {
        description: String
        identifier: ID!
        name: String
        url: String
    }

    # A person (alive, dead, undead, or fictional). See also: schema.org/Person
    type Person inherits Thing {
        email: String
        familyName: String
        givenName: String
    }

Causes the following error:

Error: Schema error: type Person cannot find inherited type Thing
    at /<path>/node_modules/graphql-s2s/src/graphqls2s.js:447:10

However if the leading comment is omitted ("# The most generic type of item. See also: schema.org/Thing") then transpilation works correctly.

nicolasdao commented 6 years ago

Hi @tmcnab ,

Thanks for catching that one. I'll fix this issue ASAP.

Cheers,

Nic

Larinel commented 6 years ago

@nicolasdao I think it caused by comment containing word type. After removed this word, everything works good

nicolasdao commented 6 years ago

Hi @tmcnab ,

I've just fixed that issue. Install the latest version (i.e., 0.16.3) and that should be working.

Thanks for reporting this issue and helping the community.

Cheers,

Nic

tmcnab commented 6 years ago

No, thank you for the awesome library!