GraphQL
[!TIP]
Just for those curious minds who always jump from one branch to another like mine:
You can find a good definition usually in glossary.
- Intro.
- Data types.
- A simple todo app written with GraphQL + ReactJS + Relay:
- Queries and mutations in depth.
- Let’s breakdown the query language a bit more.
- Functions provided by
graphql. - Document your GraphQL service API.
- GraphQL request lifecycle.
- Code-first approach.
- Auth.
- How to query information about a GraphQL schema.
- Improve developer experience.
- Security in GraphQL.
- NestJS.
- Query complexity.
- Query depth and complexity in one package.
- Write E2E tests for GraphQL.
- Nested field validation with
class-validatorin a GraphQL mutation. - In GraphQL we do not have union types, instead:
- You can use
@oneOfdirective, learn more about it here. - Here is a working example which is using
@oneOfdecorator. - A workaround if you are using an old version of
@nestjs/graphqlyou can look attestOneOfAPI.
🛑 Caution
This directive won’t allow you to send both fields at the same time. E.g. in our
CreateTemplateInputyou can only specify eitherhtmlorcss. I.e. this query will fail withOneOf Input Object \"CreateTemplateInput\" must specify exactly one key.:mutation { createTemplate( input: { css: { template: "body { color: red }" } html: { styleIds: [] subject: "some" template: "html" } } ) { id } } - You can use
- Subscription.
- Best practices.