Skip to content

extendSchema() #227

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 1 commit into from
Nov 13, 2015
Merged

extendSchema() #227

merged 1 commit into from
Nov 13, 2015

Conversation

leebyron
Copy link
Contributor

This new utility function produces a new Schema, provided an existing one and a document containing schema type definitions and extensions.

This new utility function produces a new Schema, provided an existing one and a document containing schema type definitions and extensions.
@jontonsoup
Copy link

@leebyron does this enable me to combine two schemas that have already been built?

I tried using it and got this error:

Error: Must provide valid Document AST

Thanks!

@leebyron
Copy link
Contributor Author

You could print one and then use that to extend the other, but otherwise no. This is for extending a schema for metadata only for use by client tools

@jontonsoup
Copy link

@leebyron

so something like this would work?
https://github.com/graphql/graphql-js/blob/master/src/utilities/schemaPrinter.js#L28

printed_schema = printSchema(first_schema)
combined_schema = extendSchema(second_schema, printed_schema)

@leebyron
Copy link
Contributor Author

You need to parse the printed schema into a document AST first, but yes

@jontonsoup
Copy link

@leebyron thanks! Whats the AST parser function?

This one?

export function parse(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants