Skip to content

[gatsby-transformer-json] graphql name error #7670

Closed
@eLod

Description

Description

When gatsby loads json from a directory that's name starts with numeric it fails with graphql name error (i think it's coming from the internal.type which is set by gatsby-transformer-json to start with the subdirectory name).

Steps to reproduce

  • create a new app (i used the default start v2)
  • add gatsby-source-filesystem and gatsby-transformer-json
  • create a json file like src/data/42/foo.json
  • run gatsby develop

Expected result

it should work

Actual result

Error: Names must match /^[_a-zA-Z][_a-zA-Z0-9]*$/ but "42Json" does not.
  Names must match /^[_a-zA-Z][_a-zA-Z0-9]*$/ but "42Json" does not.
  Names must match /^[_a-zA-Z][_a-zA-Z0-9]*$/ but "42JsonConnectionSort" does not.
  Names must match /^[_a-zA-Z][_a-zA-Z0-9]*$/ but "42JsonConnectionSortByFieldsEnum" does not.
  Names must match /^[_a-zA-Z][_a-zA-Z0-9]*$/ but "42JsonConnectionSortOrderValues" does not.
...

Environment

  System:
    OS: OS X El Capitan 10.11.2
    CPU: x64 Intel(R) Core(TM) i5-2500K CPU @ 3.30GHz
    Shell: 3.2.57 - /bin/bash
  Binaries:
    Node: 10.8.0 - /usr/local/bin/node
    Yarn: yarn install v0.24.6
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
success Saved lockfile.
Done in 8.10s. - /usr/local/bin/yarn
    npm: 6.3.0 - /usr/local/bin/npm
  Browsers:
    Chrome: 68.0.3440.106
    Firefox: 57.0
    Safari: 9.0.2
  npmPackages:
    gatsby: next => 2.0.0-rc.0 
    gatsby-plugin-manifest: next => 2.0.2-rc.0 
    gatsby-plugin-offline: next => 2.0.0-rc.0 
    gatsby-plugin-react-helmet: next => 3.0.0-rc.0 
    gatsby-source-filesystem: ^2.0.1-rc.0 => 2.0.1-rc.0 
    gatsby-transformer-json: ^2.1.1-rc.0 => 2.1.1-rc.0 
  npmGlobalPackages:
    gatsby-cli: 1.1.58

File contents (if changed)

gatsby-config.js: N/A
package.json: N/A
gatsby-node.js: N/A
gatsby-browser.js: N/A
gatsby-ssr.js: N/A

Metadata

Assignees

No one assigned

    Labels

    type: maintenanceAn issue or pull request describing a change that isn't a bug, feature or documentation change

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions