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

buildSchema/extendSchema: add support for extensions #2248

Merged

Conversation

IvanGoncharov
Copy link
Member

Fixes #922

@IvanGoncharov IvanGoncharov added the PR: feature 🚀 requires increase of "minor" version number label Nov 6, 2019
@IvanGoncharov
Copy link
Member Author

Current state:

  • Missing support for schema extensions
  • Missing tests for Enums, Input Object, and Unions
  • Missing tests for extendSchema

@IvanGoncharov IvanGoncharov mentioned this pull request Dec 23, 2019
@IvanGoncharov IvanGoncharov marked this pull request as ready for review December 27, 2019 05:36
@IvanGoncharov IvanGoncharov merged commit 1283c84 into graphql:master Dec 27, 2019
@IvanGoncharov IvanGoncharov deleted the buildSchema-support-extensions branch December 27, 2019 06:17
@IvanGoncharov IvanGoncharov added PR: breaking change 💥 implementation requires increase of "major" version number and removed PR: feature 🚀 requires increase of "minor" version number labels Jan 7, 2020
@sonamp
Copy link

sonamp commented May 24, 2022

Looks like it is not supported anymore. @IvanGoncharov could you please confirm if the extend type support is still there?

@yaacovCR
Copy link
Contributor

What version are you using? Can you post a link to a reproduction?

@sonamp
Copy link

sonamp commented May 26, 2022

@yaacovCR Seems the issue is with graphql-tools/load, it doesn't recognize extend in schema

schema.graphql--
extend type Post {
    createdAt: String
}

Running code

const load = require('@graphql-tools/load')
const { GraphQLFileLoader } = require('@graphql-tools/graphql-file-loader')

async function main() {
const c = await load.loadSchema('/code/graphqlPoc/graphql-server/src/schema.graphql', {
    loaders: [new GraphQLFileLoader()]
})
console.log(c)
}
main()

return errors --

Error: Cannot extend type "Post" because it is not defined.
    at assertValidSDL (/code/graphqlPoc/node_modules/graphql/validation/validate.js:135:11)
    at Object.buildASTSchema (/code/graphqlPoc/node_modules/graphql/utilities/buildASTSchema.js:44:34)
    at makeExecutableSchema (/code/graphqlPoc/node_modules/@graphql-tools/schema/index.js:495:26)
    at Object.mergeSchemas (/code/graphqlPoc/node_modules/@graphql-tools/schema/index.js:532:12)
    at Object.loadSchema (/code/graphqlPoc/node_modules/@graphql-tools/load/index.js:622:29)
    at async main (/code/graphqlPoc/graphql-server/src/graph.js:5:11)

@graphql-tools/load - v7.5.13

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR: breaking change 💥 implementation requires increase of "major" version number
Projects
None yet
Development

Successfully merging this pull request may close these issues.

buildASTSchema() should throw on encountering extend definition
3 participants