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
Changes from 1 commit
Commits
Show all changes
111 commits
Select commit Hold shift + click to select a range
9926e2d
Schema refactor WIP
freiksenet Feb 1, 2019
d9e6873
Oops
freiksenet Feb 1, 2019
08ab5c2
First working version
freiksenet Feb 4, 2019
1aef564
First working version
freiksenet Feb 4, 2019
ac49f5b
Almost working site
freiksenet Feb 4, 2019
f369296
progress
freiksenet Feb 5, 2019
6add8d9
WWW working
freiksenet Feb 6, 2019
2e25030
Working add type defs
freiksenet Feb 7, 2019
b532d1b
addResolvers
freiksenet Feb 8, 2019
69162b6
Add node model
stefanprobst Feb 8, 2019
b9af766
Handle NonNull and pass context and info in runQuery
stefanprobst Feb 9, 2019
a5b0d55
Don't fetch resolved id again
stefanprobst Feb 9, 2019
f7d80f0
Minor fixes
stefanprobst Feb 9, 2019
23423db
Make www build with Loki
stefanprobst Feb 9, 2019
6e11926
Fix tests
stefanprobst Feb 10, 2019
ed9314b
Pull out resolving nodes
stefanprobst Feb 10, 2019
79754e6
Fix getExampleValue
stefanprobst Feb 10, 2019
6f1e715
Port exampleValue tests
stefanprobst Feb 10, 2019
12a9819
Fixes for type inference
stefanprobst Feb 10, 2019
0ca1294
Infer errors and stuff
freiksenet Feb 11, 2019
b8d0d6f
Merge remote-tracking branch 'stefanprobst/schema-refactor-new-sp' in…
freiksenet Feb 11, 2019
15df9e3
Lint
freiksenet Feb 11, 2019
9a59b47
More changes
freiksenet Feb 12, 2019
7878818
Fix issue with default resolvers
freiksenet Feb 12, 2019
779cb39
Fix tests
freiksenet Feb 12, 2019
d45c97c
Port more tests
freiksenet Feb 12, 2019
10f1405
Move schema composer creation to separate location
freiksenet Feb 13, 2019
c7b1177
Most tests pass
freiksenet Feb 13, 2019
8dbc6e7
Move tests to better location
freiksenet Feb 13, 2019
bf02578
Readd list sorting option
freiksenet Feb 13, 2019
b6ec46f
Node model as a class
freiksenet Feb 13, 2019
add0666
Model layer tests
freiksenet Feb 13, 2019
da8469d
Fix flow type
freiksenet Feb 14, 2019
e7bb44b
Merge remote-tracking branch 'origin/master' into schema-refactor-new
freiksenet Feb 14, 2019
d002f9c
Restore prepare-nodes improvements
freiksenet Feb 14, 2019
73a1f2d
Fixes
freiksenet Feb 14, 2019
448bcfe
Port more tests (#11757)
stefanprobst Feb 14, 2019
2c0b2cf
Merge remote-tracking branch 'origin/master' into schema-refactor-new
freiksenet Feb 14, 2019
292200f
WIP kitchen sink
freiksenet Feb 14, 2019
1cb0aab
Fix tests for Loki, and minor changes (#11765)
stefanprobst Feb 15, 2019
e512743
Satisfy linter
freiksenet Feb 15, 2019
017bfa1
Mix dates and strings behaviour
freiksenet Feb 15, 2019
ccb0bb6
Test more stuff with runQuery
freiksenet Feb 15, 2019
58297c7
Add resolvers test
freiksenet Feb 15, 2019
1d4272e
Updated API names to match gatsby
freiksenet Feb 18, 2019
7666727
3rd party schema tests
freiksenet Feb 18, 2019
7e0261f
More fixes
freiksenet Feb 18, 2019
7f661eb
Beter example in using-type-defs
freiksenet Feb 18, 2019
3ddcf99
More fixes
freiksenet Feb 18, 2019
ff85e86
Add NodeModel tests (#11880)
stefanprobst Feb 19, 2019
31b11f3
[schema] Better example (#11892)
stefanprobst Feb 19, 2019
0c5e13a
Fix conflicting field issue
freiksenet Feb 19, 2019
a440e8e
Handle multiple return values from setFieldsOnGraphQLNodeType (#12048)
stefanprobst Feb 25, 2019
c310140
Fix conflicting fields priority on nested type (#11900)
stefanprobst Feb 25, 2019
c6a7826
Merge remote-tracking branch 'upstream/master' into schema-refactor-new
stefanprobst Feb 26, 2019
4dfc057
Allow field type on third-party type (#11970)
stefanprobst Feb 27, 2019
879cd7b
Make original field resolver available on info (#12159)
stefanprobst Feb 28, 2019
fbfa6b4
[schema] Make output fields non-null (#12097)
stefanprobst Feb 28, 2019
a1c01a6
[schema] Add schema query tests, inference fixes (#12190)
stefanprobst Mar 1, 2019
e344292
[schema] Add default page dependency path (#12220)
stefanprobst Mar 1, 2019
5db668a
Merge remote-tracking branch 'origin/master' into schema-refactor-new
freiksenet Mar 4, 2019
9992c12
chore(release): Publish
freiksenet Mar 4, 2019
ab9ffac
More tests and some fixes
freiksenet Mar 4, 2019
6cc1992
Revert "chore(release): Publish"
freiksenet Mar 4, 2019
b90b05f
Allow custom resolveType (#12309)
stefanprobst Mar 5, 2019
238cc2b
v2.2.0-alpha.0
freiksenet Mar 4, 2019
b706829
More fixes and tests
freiksenet Mar 5, 2019
9269305
More tests, refine infer logic
freiksenet Mar 5, 2019
52d6012
[schema] Make id field on InputObjectType type String (#12335)
stefanprobst Mar 6, 2019
1e58b54
v2.2.0-alpha.1
freiksenet Mar 5, 2019
7eda0b2
Upgrade schema composer
freiksenet Mar 6, 2019
222f3da
v2.2.0-alpha.2
freiksenet Mar 6, 2019
e76e7e8
Fix loxi test issue
freiksenet Mar 6, 2019
fe5fe1d
Add type builders internally
freiksenet Mar 6, 2019
081fa15
Add type builders internally
freiksenet Mar 6, 2019
f3a7cf6
Added type builders to the API
freiksenet Mar 6, 2019
5522c28
v2.2.0-alpha.3
freiksenet Mar 6, 2019
67ee427
[schema] Add NodeModel docs (#12354)
stefanprobst Mar 7, 2019
8628a48
Check for type names reserved for internal use (#12373)
stefanprobst Mar 7, 2019
4e09a7d
Allow custom scalars in input filter (#12375)
stefanprobst Mar 7, 2019
3e06835
Correctly camelcase connections (#12378)
stefanprobst Mar 7, 2019
587e9ef
v2.2.0-alpha.4
freiksenet Mar 7, 2019
16dab78
v2.2.0-alpha.5
freiksenet Mar 7, 2019
5a9a5f0
[schema] Remove empty input fields (#12380)
stefanprobst Mar 8, 2019
6c86d28
[schema] Add code frame to SDL parsing error (#12401)
stefanprobst Mar 8, 2019
ef567f0
Merge branch 'master' into schema-refactor-new
freiksenet Mar 8, 2019
582bd94
v2.2.0-alpha.6
freiksenet Mar 8, 2019
d61a776
Add blog post
freiksenet Mar 12, 2019
3f3e8fe
Don't use npx in example README
muescha Mar 16, 2019
71c391f
Update docs for new documentationjs version (#12615)
stefanprobst Mar 18, 2019
75da5e5
Merge remote-tracking branch 'origin/master' into schema-refactor-new
freiksenet Mar 18, 2019
1bc4013
v2.2.0-rc.1
freiksenet Mar 18, 2019
0a3a750
Revert "v2.2.0-rc.1"
freiksenet Mar 18, 2019
59a2dd2
Remove extra dep
freiksenet Mar 18, 2019
511abb3
Fix date
freiksenet Mar 18, 2019
f46154b
chore(blog): add schema customization blog post release (#12522)
DSchau Mar 18, 2019
582db20
Update blog as per review
freiksenet Mar 18, 2019
50ed38b
Docs
freiksenet Mar 18, 2019
4a6b108
Update docs/blog/2019-03-18-releasing-new-schema-customization/index.md
stefanprobst Mar 18, 2019
ecf5656
Add tweet
freiksenet Mar 18, 2019
0a48280
Update docs/blog/2019-03-18-releasing-new-schema-customization/index.md
stefanprobst Mar 18, 2019
3f2c4a0
Merge remote-tracking branch 'origin/master' into schema-refactor-new
freiksenet Mar 18, 2019
5c2b25a
Remove dep
stefanprobst Mar 18, 2019
c7c7ae0
Move tweet
freiksenet Mar 18, 2019
78cbab4
[schema] Ignore empty strings in example value creation (#12646)
stefanprobst Mar 19, 2019
7d48322
Add tests
freiksenet Mar 19, 2019
196ef58
Fix snapshot
freiksenet Mar 19, 2019
09f0d91
v2.2.0-rc.2
freiksenet Mar 19, 2019
4dcb431
Revert "v2.2.0-rc.2"
freiksenet Mar 19, 2019
54ff3b6
Change blog date
freiksenet Mar 19, 2019
04f7694
use <PROJECT_ROOT> in fixture (#12662)
pieh Mar 19, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Restore prepare-nodes improvements
  • Loading branch information
freiksenet committed Feb 14, 2019
commit d002f9c17788771bcb8c9f761e99b73890b35eb4
44 changes: 14 additions & 30 deletions packages/gatsby/src/redux/prepare-nodes.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,12 @@ const enhancedNodeCacheId = ({ node, args }) =>
function awaitSiftField(fields, node, k) {
const field = fields[k]
if (field.resolve) {
return field.resolve(
node,
{},
{},
{
fieldName: k,
}
)
const { schema } = store.getState()
return field.resolve(node, {}, withResolverContext({}, schema), {
fieldName: k,
schema,
returnType: field.type,
})
} else if (node[k] !== undefined) {
return node[k]
}
Expand All @@ -45,32 +43,18 @@ function resolveRecursive(node, siftFieldsObj, gqFields) {
.then(v => {
const innerSift = siftFieldsObj[k]
const innerGqConfig = gqFields[k]
if (
_.isObject(innerSift) &&
v != null &&
innerGqConfig &&
innerGqConfig.type
) {
if (_.isFunction(innerGqConfig.type.getFields)) {

const innerType = getNullableType(innerGqConfig.type)
const innerListType = getNamedType(innerType)
if (_.isObject(innerSift) && v != null && innerType) {
if (_.isFunction(innerType.getFields)) {
// this is single object
return resolveRecursive(
v,
innerSift,
innerGqConfig.type.getFields()
)
} else if (
_.isArray(v) &&
innerGqConfig.type.ofType &&
_.isFunction(innerGqConfig.type.ofType.getFields)
) {
return resolveRecursive(v, innerSift, innerType.getFields())
} else if (_.isArray(v) && _.isFunction(innerListType.getFields)) {
// this is array
return Promise.all(
v.map(item =>
resolveRecursive(
item,
innerSift,
innerGqConfig.type.ofType.getFields()
)
resolveRecursive(item, innerSift, innerListType.getFields())
)
)
}
Expand Down