swagger-to-graphql: Error: Names must match /^[_a-zA-Z][_a-zA-Z0-9]*$/

I’m trying to run against this schema from Musixmatch SDK

but I get

$ node app.js 
Error: Names must match /^[_a-zA-Z][_a-zA-Z0-9]*$/ but "get_album.tracks.get_message_header" does not.
    at invariant (/tools/swagger-to-graphql/node_modules/graphql/jsutils/invariant.js:19:11)
    at assertValidName (/tools/swagger-to-graphql/node_modules/graphql/utilities/assertValidName.js:28:27)
    at new GraphQLObjectType (/tools/swagger-to-graphql/node_modules/graphql/type/definition.js:224:42)
    at createGQLObject (/tools/swagger-to-graphql/lib/type_map.js:68:10)
    at jsonSchemaTypeToGraphQL (/tools/swagger-to-graphql/lib/type_map.js:94:12)
    at _.mapValues (/tools/swagger-to-graphql/lib/type_map.js:79:13)
    at /tools/swagger-to-graphql/node_modules/lodash/lodash.js:13303:38
    at /tools/swagger-to-graphql/node_modules/lodash/lodash.js:4917:15
    at baseForOwn (/tools/swagger-to-graphql/node_modules/lodash/lodash.js:2979:24)
    at Function.mapValues (/tools/swagger-to-graphql/node_modules/lodash/lodash.js:13302:7)
    at getTypeFields (/tools/swagger-to-graphql/lib/type_map.js:76:20)
    at createGQLObject (/tools/swagger-to-graphql/lib/type_map.js:71:13)
    at jsonSchemaTypeToGraphQL (/tools/swagger-to-graphql/lib/type_map.js:94:12)
    at _.mapValues (/tools/swagger-to-graphql/lib/type_map.js:79:13)
    at /tools/swagger-to-graphql/node_modules/lodash/lodash.js:13303:38
    at /tools/swagger-to-graphql/node_modules/lodash/lodash.js:4917:15
    at baseForOwn (/tools/swagger-to-graphql/node_modules/lodash/lodash.js:2979:24)
    at Function.mapValues (/tools/swagger-to-graphql/node_modules/lodash/lodash.js:13302:7)
    at getTypeFields (/tools/swagger-to-graphql/lib/type_map.js:76:20)
    at createGQLObject (/tools/swagger-to-graphql/lib/type_map.js:71:13)
    at Object.keys.filter.reduce (/tools/swagger-to-graphql/lib/index.js:59:18)
    at Array.reduce (native)

Thank you.

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 20 (9 by maintainers)

Most upvoted comments

@yarax I have the same issue, can we use something like this https://github.com/sindresorhus/camelcase to make sure all generate GraphQL code is valid?

So I would probably advice you to share GraphiQL interface for your API clients, like github has done it https://developer.github.com/early-access/graphql/guides/accessing-graphql/