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

[gatsby-transformer-yaml] README.md differs from reality #3081

Closed
EvansJahja opened this issue Nov 30, 2017 · 5 comments
Closed

[gatsby-transformer-yaml] README.md differs from reality #3081

EvansJahja opened this issue Nov 30, 2017 · 5 comments

Comments

@EvansJahja
Copy link
Contributor

This issue refers to gatsby-transformer-yaml README.md.
I'm using gatsby-transformer-yaml 1.5.12.

Summary:
I believe README.md is not accurate or does not represent the current version thus needs to be updated.

Highlights:

  • allLettersYaml instead of allLetters
  • type is inside internal and does not reside alongside value

Issue 1. -Yaml ending.

The readme says:
...
Then the following three nodes would be created.

;[
  {
    value: "a",
    type: "Letters",
  },
  {
    value: "b",
    type: "Letters",
  },
  {
    value: "c",
    type: "Letters",
  },
]

However, after running gatsby with this directory structure:

src
\-- data
      \-- letters
           \-- letters.yml

I only have this node:

allLettersYaml

as opposed to

allLetters

as stated in the README. I don't knkow where the Yaml ending comes from.

Issue 2. - type does not exist

The Readme says:

;[
  {
    value: "a",
    type: "Letters",
  },
  {
    value: "b",
    type: "Letters",
  },
  {
    value: "c",
    type: "Letters",
  },
]

However, running allLettersYaml through GraphQL:

allLettersYaml {
  edges {
      node {
        value
        type
      }
  }
}

Doesn't work, because there is no type field. Looking up the source code reveals that this happens because type is inside internal.

But, this works:

allLettersYaml {
  edges {
      node {
        value
        internal {
          type
        }
      }
  }
}

Conclusion

I believe the Readme needs updating, but it could also be that I'm wrong, maybe I use the wrong version or interpreted the Readme wrongly. If I'm right and indeed the Readme needs updating, I'd like to give PR.

Thank you.

@EvansJahja EvansJahja changed the title [gatsby-transformer-yaml] Following README.md differs from reality [gatsby-transformer-yaml] README.md differs from reality Nov 30, 2017
@DamnedScholar
Copy link

I'm having all of the same problems, except that I can't even get value out of my YAML nodes (image below). The readme definitely needs to be updated to the correct information. I used npm install gatsby-transformer-yaml yesterday, so I know for sure that I have 1.5.12.

image

@KyleAMathews
Copy link
Contributor

@DamnedScholar does your yaml file have a field named "value"?

@Charon77 you're right! Would you like to PR a fix?

@DamnedScholar
Copy link

@KyleAMathews Ah-ha! I see now. That was my fault, of course, but I was having trouble finding allMenuYaml in the first place (just like OP did, for the same reasons), so I guess it seemed like it must be attached to the same thing. Thanks for the reality check.

@EvansJahja
Copy link
Contributor Author

@KyleAMathews Sure thing!
I'll probably rewrite some parts of the readme as well. I'll be working on this for the next couple of days.
@DamnedScholar
I had that problem because one of these:

  1. I forgot to add gatsby-source-filesystem
  2. Forgot pointing gatsby-source-filesystem to the right folder / file
  3. Have no yaml file

among other things.

@EvansJahja
Copy link
Contributor Author

PR in #3154

KyleAMathews pushed a commit that referenced this issue Dec 13, 2017
* Adds modle.exports example

* Moves module.exports example to 'How to use'

* Describes Parsing algorithm

* Renames 'value' to 'character' to avoid confusion

* Renames more 'value' to 'character'; Changes 'allLetters' to 'allLettersYaml'

* Supported extensions, How to query, Note that you need files

* Notes that .yaml and .yml are used in the same way.
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

No branches or pull requests

3 participants