Skip to content

Ensure a consistent schema for gatsby-plugin-documentationjs and add TypeScript support #13692

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

Merged
merged 2 commits into from
Apr 30, 2019

Conversation

devongovett
Copy link
Contributor

This adds a schema definition for gatsby-plugin-documentationjs to ensure that it is consistent no matter what files are actually processed. Currently, with gatsby's automatic schema generation, the schema can be missing fields if they are unused by the code that is being parsed and therefore the query would have to change as the code changes. This ensures that the schema will have all fields available no matter what.

Also, TypeScript support was recently added to documentationjs, so this enables .ts and .tsx files to be processed as well.

@freiksenet
Copy link
Contributor

This is awesome. I'll test it with Gatsby docs website.

type: DoctrineType
default: JSON
augments: [DocumentationJs]
examples: [JSON]
Copy link
Contributor

Choose a reason for hiding this comment

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

This (and other JSON fields in DoctrineType) do change schema that will be generated (which is not a blocker - just wanted to mentioned that we would need to bump major as this will be breaking change)

Copy link
Contributor

Choose a reason for hiding this comment

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

I feel that if shape of those types is defineable, it should be fully typed. JSON type should only be used in cases where shape of data is impossible to define.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Examples probably can, but I specifically made the ones in DoctrineType JSON because they can be circularly typed, and therefore impossible to query with GraphQL...

Copy link
Contributor

@freiksenet freiksenet left a comment

Choose a reason for hiding this comment

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

Thank you!

@freiksenet freiksenet merged commit 950b9d6 into gatsbyjs:master Apr 30, 2019
@gatsbot
Copy link

gatsbot bot commented Apr 30, 2019

Holy buckets, @devongovett — 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. We’ve got Gatsby t-shirts, stickers, hats, scrunchies, and much more. (You can also unlock even more free swag with 5 contributions — wink wink nudge nudge.) See gatsby.dev/swag for details.
  2. We just invited you to join the Gatsby organization on GitHub. This will add you to our team of maintainers. Accept the invite by visiting https://github.com/orgs/gatsbyjs/invitation. 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!

@freiksenet
Copy link
Contributor

Published as [email protected] (because of possible breaking change). Thank you @devongovett!

@pieh
Copy link
Contributor

pieh commented Apr 30, 2019

I think we still need to do some work here -

probably need to be bumped to ^10.1.0 (to actually support Typescript - according to https://github.com/documentationjs/documentation/blob/master/CHANGELOG.md )

@devongovett
Copy link
Contributor Author

Oops, yes. 🤦‍♂️ will make another pr

devongovett added a commit to devongovett/gatsby that referenced this pull request Apr 30, 2019
Followup to gatsbyjs#13692. This actually adds typescript support.
@devongovett devongovett deleted the documentationjs-schema branch April 30, 2019 17:41
DSchau pushed a commit that referenced this pull request May 1, 2019
…typescript support (#13751)

* Bump documentationjs to 10.1.0

Followup to #13692. This actually adds typescript support.

* chore: add yarn lock
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.

3 participants