{"library":"ponder-enrich-gql-docs-middleware","title":"Ponder GraphQL Docstring Enrichment Middleware","description":"This package, `ponder-enrich-gql-docs-middleware`, provides a middleware for Ponder-based GraphQL APIs, enabling developers to augment their GraphQL documentation with detailed docstrings for types, fields, and queries. Currently at version `0.1.3`, it is in active development with a consistent release of minor versions, indicating potential breaking changes between `0.x.x` releases as it approaches a stable 1.0. Its core value lies in enhancing API discoverability and usability by enriching introspection query results with human-readable descriptions, without modifying the underlying GraphQL schema or affecting runtime performance. Key differentiators include its seamless integration into the Ponder ecosystem, comprehensive TypeScript support, zero runtime overhead due to its introspection-only processing, and a suite of helper functions for automatically generating common documentation patterns like pagination and filtering, significantly reducing manual documentation effort.","language":"javascript","status":"active","last_verified":"Thu Apr 23","install":{"commands":["npm install ponder-enrich-gql-docs-middleware"],"cli":null},"imports":["import { createDocumentationMiddleware } from 'ponder-enrich-gql-docs-middleware';","import { extendWithBaseDefinitions } from 'ponder-enrich-gql-docs-middleware';","import { generatePageDocs } from 'ponder-enrich-gql-docs-middleware';","import { generateFilterDocs } from 'ponder-enrich-gql-docs-middleware';"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import { \n  createDocumentationMiddleware, \n  extendWithBaseDefinitions, \n  generatePageDocs\n} from \"ponder-enrich-gql-docs-middleware\";\nimport { ponder } from \"ponder:registry\";\nimport { graphql } from \"ponder\";\n\n// Define your documentation object with base definitions and generated pagination docs\nconst docs = extendWithBaseDefinitions({\n  // Define specific type and field descriptions\n  User: \"Represents a user in the system\",\n  \"User.email\": \"The user's email address\",\n  \"User.name\": \"The user's full name\",\n\n  // Dynamically generate documentation for pagination on the 'User' type\n  ...generatePageDocs(\"User\", \"user\"),\n});\n\n// Initialize the documentation middleware with the defined documentation\nconst docMiddleware = createDocumentationMiddleware(docs, { debug: false });\n\n// Apply the documentation middleware and then the Ponder GraphQL handler to your /graphql endpoint\n// The order is important: middleware first, then the actual GraphQL handler\nponder.use(\"/graphql\", docMiddleware);\nponder.use(\"/graphql\", graphql());\n\nconsole.log('Ponder GraphQL endpoint enriched with documentation middleware.');","lang":"typescript","description":"Demonstrates how to initialize the documentation middleware with custom and generated docstrings and apply it to a Ponder GraphQL endpoint. It includes basic type definitions and dynamic pagination documentation.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}