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

Add directives to FieldDefinition #264

Closed
wants to merge 1 commit into from

Conversation

igorcanadi
Copy link
Contributor

This pull requests adds a new feature to the language -- directives for fields in type definitions and extensions. For example, now you're able to do this:

type Hello {
   world: String @mock(value: "hello")
}

We need directives for fields to enable the mock functionality we're building -- we'd like product developers to quickly specify some mock data on top of which they can build UI. That way we decouple building UI and server endpoints.

We could add directives to fields in a query, but if the platform is using type models, it's easier to add @mock to fields in a type definition -- the auto-generated type model just needs to override the default field getter.

@igorcanadi
Copy link
Contributor Author

BTW this PR is just extending the language, AST and visitor. I'm still working on a separate PR that will enable directives in extendSchema(). Let me know if there's anything else I also need to implement.

@igorcanadi
Copy link
Contributor Author

I'll merge this PR with #265. Stacked diffs are a pain to handle in github.

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.

2 participants