Skip to content
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

fix: ensure graphql key (starting with numeric) is valid #7913

Merged
merged 2 commits into from
Sep 6, 2018

Conversation

eLod
Copy link
Contributor

@eLod eLod commented Sep 6, 2018

handling keys that start with numeric, see #4000

@pieh
Copy link
Contributor

pieh commented Sep 6, 2018

Hey @eLod, could you also add some tests here - to this inline fixture

const nodes = [
{
id: `foo`,
name: `The Mad Max`,
type: `Test`,
"key-with..unsupported-values": true,
hair: 1,
date: `1012-11-01`,
anArray: [1, 2, 3, 4],
aNestedArray: [[1, 2, 3, 4], [5, 6, 7, 8]],
anObjectArray: [
{ aString: `some string`, aNumber: 2, aBoolean: true },
{ aString: `some string`, aNumber: 2, anArray: [1, 2] },
{ anotherObjectArray: [{ bar: 10 }] },
],
deepObject: {
level: 1,
deepObject: {
level: 2,
deepObject: {
level: 3,
},
},
},
"with space": 1,
"with-hyphen": 2,
"with resolver": `1012-11-01`,
aBoolean: true,
externalUrl: `https://example.com/awesome.jpg`,
domain: `pizza.com`,
frontmatter: {
date: `1012-11-01`,
title: `The world of dash and adventure`,
blue: 100,
},
},
{
id: `boo`,
name: `The Mad Wax`,
type: `Test`,
hair: 2,
date: `1984-10-12`,
anArray: [1, 2, 5, 4],
aNestedArray: [[1, 2, 3, 4]],
anObjectArray: [{ anotherObjectArray: [{ baz: `quz` }] }],
"with space": 3,
"with-hyphen": 4,
frontmatter: {
date: `1984-10-12`,
title: `The world of slash and adventure`,
blue: 10010,
},
},
]
) and some test running queries against that in that file for more "integration" like coverage of this?

@pieh pieh self-assigned this Sep 6, 2018
@eLod
Copy link
Contributor Author

eLod commented Sep 6, 2018

@pieh sure, just to be sure: so you want me to add a value to that nodes elements with a key like 123 and check that the graphql has keys _123 right? and put into this test:

it(`Handle invalid graphql field names`, async () => {

do you want me to add multiple keys or just a single one?

@pieh
Copy link
Contributor

pieh commented Sep 6, 2018

Yeah, this sounds good! 👍

@pieh
Copy link
Contributor

pieh commented Sep 6, 2018

Looking good! Just waiting for appveyor to finish before merging :)

Copy link
Contributor

@pieh pieh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @eLod!

@pieh pieh merged commit dd8f79c into gatsbyjs:master Sep 6, 2018
@gatsbot
Copy link

gatsbot bot commented Sep 6, 2018

Holy buckets, @eLod — we just merged your PR to Gatsby! 💪💜

Gatsby is built by awesome people like you. Let us say “thanks” in two ways:

  1. We’d like to send you some Gatsby swag. As a token of our appreciation, you can go to the Gatsby Swag Store and log in with your GitHub account to get a coupon code good for one free piece of swag. (Currently we’ve got a couple t-shirts available, plus some socks that are really razzing our berries right now.)
  2. We just invited you to join the Gatsby organization on GitHub. This will add you to our team of maintainers. You’ll receive an email shortly asking you to confirm. By joining the team, you’ll be able to label issues, review pull requests, and merge approved pull requests.

If there’s anything we can do to help, please don’t hesitate to reach out to us: tweet at @gatsbyjs and we’ll come a-runnin’.

Thanks again!

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

Successfully merging this pull request may close these issues.

2 participants