### Generate GraphQL Documentation with graphql-markdown Source: https://github.com/vtex-apps/graphql-example/blob/main/docs/README.md This command generates markdown documentation from a GraphQL schema using the graphql-markdown tool. It's a common task for documenting GraphQL APIs within a project. Ensure you have yarn installed and the graphql-markdown package configured in your project. ```bash yarn graphql-markdown ``` -------------------------------- ### GraphQL Schema with Cache Control Directives Source: https://github.com/vtex-apps/graphql-example/blob/main/docs/README.md Defines GraphQL types (Product, Order, Query) and applies @cacheControl directives to specify caching behavior (maxAge and scope). This allows for fine-grained control over how query responses are cached by the CDN. ```graphql type Product @cacheControl(maxAge: LONG, scope: PUBLIC) { id: ID! name: String description: String } type Order @cacheControl(scope: PRIVATE) { id: ID! statusDescription: String description: String } type Query { listOrders: [Order] listProducts: [Product] } ``` -------------------------------- ### Specify GraphQL Provider using @context Directive Source: https://github.com/vtex-apps/graphql-example/blob/main/docs/README.md This snippet demonstrates how to use the @context directive with the 'provider' argument in a GraphQL query. It allows a client to explicitly specify which app's definition of a field should be used, resolving potential conflicts. This is useful when multiple apps might define the same field. ```graphql query getProducts { products @context(provider: "vtex.products-graphql") { name } } ``` -------------------------------- ### Specify GraphQL Sender using @context Directive Source: https://github.com/vtex-apps/graphql-example/blob/main/docs/README.md This snippet shows how to use the @context directive with the 'sender' argument in a GraphQL query. It allows an app to announce its name, enabling the GraphQL server to restrict access to schema parts based on the app's direct dependencies. This helps in managing access control and preventing unexpected conflicts. ```graphql { products @context(sender: "vtex.client-app@1.2.3") { name } } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.