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

feat(gatsby): allow schema customization #11480

Merged
merged 111 commits into from
Mar 19, 2019
Merged

feat(gatsby): allow schema customization #11480

merged 111 commits into from
Mar 19, 2019

Conversation

freiksenet
Copy link
Contributor

@freiksenet freiksenet commented Feb 1, 2019

Rendered release blog post

Is in runnable state right now. Try it:

yarn add gatsby@schema-customization

Report all bugs in #12272.

Description

Related Issues

@freiksenet freiksenet requested a review from a team as a code owner February 1, 2019 16:24
@freiksenet
Copy link
Contributor Author

My next plans:

  • Confirm www can build
  • Add addTypeDefs and addResolvers apis
  • Put this under a flag
  • Port all tests
  • Make an RFC and try to get feedback
  • Get it merged

Longer term stuff / nice to haves

  • API to add directives
  • Better resolver writing experience
  • Clean up of inference
  • Schema directives to selectively enable/disable inference for types
type: `String!`,
})
})
InternalTC.getITC()
Copy link
Contributor

Choose a reason for hiding this comment

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

Probably not needed now that we use toInputObjectType directly (same with NodeInterface.getITC()) - We called this here to register a non-prefixed name (Nodenput and not MarkdownParentNodeInput - but we should try to remove prefixing upstream)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What do you mean by "remove prefixing upstream"?

Copy link
Contributor

Choose a reason for hiding this comment

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

Just not adding the type name here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

One thing I was thinking about is introducing concept of a "TypeSetComposer" which is an abstraction on top of TypeComporers, InputTypeComposers etc and allows defining dependencies and transformations. Eg we can then write own getITC that knows how to not prefix. This would also solve the issue with clearing the ITC cache.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'll have to think a bit about this, but not sure if we need to do much more than we already have: can we just call tc.removeInputTypeComposer(); tc.getITC() here? What other issues would TypeSetComposer address?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I thought it might also have all the other type composers linked, like filter, sort etc. So we could clear all the generated types in one go when original type changes. Could be useful for things like live schema reload.

@freiksenet freiksenet changed the title [WIP] Schema refactor Mar 18, 2019
DSchau and others added 3 commits March 18, 2019 11:04
* chore(blog): add schema customization blog post release

* chore: tweak first sentence

* Update docs/blog/2019-03-18-releasing-new-schema-customization/index.md

Co-Authored-By: DSchau <DSchau@users.noreply.github.com>

* Update docs/blog/2019-03-18-releasing-new-schema-customization/index.md

Co-Authored-By: DSchau <DSchau@users.noreply.github.com>

* Update docs/blog/2019-03-18-releasing-new-schema-customization/index.md

Co-Authored-By: DSchau <DSchau@users.noreply.github.com>

* Update docs/blog/2019-03-18-releasing-new-schema-customization/index.md

Co-Authored-By: DSchau <DSchau@users.noreply.github.com>

* Update docs/blog/2019-03-18-releasing-new-schema-customization/index.md

Co-Authored-By: DSchau <DSchau@users.noreply.github.com>

* Update docs/blog/2019-03-18-releasing-new-schema-customization/index.md

Co-Authored-By: DSchau <DSchau@users.noreply.github.com>

* chore: address feedback

* Update docs/blog/2019-03-18-releasing-new-schema-customization/index.md
Co-Authored-By: freiksenet <freiksenet@gmail.com>
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.

Awesome work on this @freiksenet and @stefanprobst! We were testing and verifying this on multiple open source sites checking if it breaks things and it looks solid right now

@pieh pieh changed the title Schema refactor Mar 19, 2019
@freiksenet freiksenet merged commit 07e69be into master Mar 19, 2019
@wardpeet wardpeet deleted the schema-refactor-new branch June 27, 2019 06:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
6 participants