Registry / devops / graphdoc-plugin-schema

graphdoc-plugin-schema

JSON →
library2.0.0jsnpmunverified

A configurable plugin for @2fd/graphdoc that generates HTML documentation for GraphQL schemas using the built-in document-schema plugin. Version 2.0.0 is the latest stable release. It allows customization of the document title and asset loading, and must be used with graphdoc-plugin-flexible to disable the default document-schema plugin to avoid duplication. It is faster than the default document-schema plugin and supports markdown in descriptions.

npm install graphdoc-plugin-schema
INSTALL
IMPORT
SIG · GRAPHDOC-PLUGIN-SC
G
graphdoc-plugin-schema
devopsjavascriptv2.0.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Plugin
import { Plugin } from 'graphdoc-plugin-schema'
const Plugin = require('graphdoc-plugin-schema')
ESM import; CommonJS require is not supported because the package only exports an ES module.

Configures graphdoc-plugin-schema with a custom title and disabled assets, plus graphdoc-plugin-flexible to disable the default document-schema plugin.

// package.json { "scripts": { "doc": "graphdoc -p graphdoc/../../graphdoc-plugin-schema -p graphdoc/../../graphdoc-plugin-flexible -s ./schema.graphql -o ./build/documentation" }, "graphdoc-plugin-flexible": { "document.schema": { "disable": true } }, "graphdoc-plugin-schema": { "documentTitle": "My Schema", "enableAssets": false }, "devDependencies": { "@2fd/graphdoc": "2.4.0", "graphdoc-plugin-flexible": "1.0.2", "graphdoc-plugin-schema": "2.0.0" } }
Debug
Known issues
breakingRequires graphdoc-plugin-flexible to disable the default document-schema plugin, otherwise duplicate sections appear.
fix
Add graphdoc-plugin-flexible and configure 'document.schema': { 'disable': true }.
affects: >=1.0.0
gotchaThe plugin path must include 'graphdoc/../../' prefix when using -p option in graphdoc CLI.
fix
Use '-p graphdoc/../../graphdoc-plugin-schema' instead of '-p graphdoc-plugin-schema'.
affects: >=1.0.0
gotchaConfiguration is read from package.json under the 'graphdoc-plugin-schema' key; environment variables are not supported.
fix
Add configuration to package.json as documented.
affects: >=1.0.0
deprecatedVersion 2.0.0 now uses ESM only; CommonJS require() will fail.
fix
Use ES module import: import { Plugin } from 'graphdoc-plugin-schema'.
affects: 2.0.0
Errors
Common errors & fixes
Error: Cannot find module 'graphdoc-plugin-schema'
The plugin path is not correctly specified in the graphdoc command.
fix
Use '-p graphdoc/../../graphdoc-plugin-schema' instead of '-p graphdoc-plugin-schema'.
Duplicate schema section in output
The default document-schema plugin is still enabled.
fix
Add graphdoc-plugin-flexible and set 'document.schema': { 'disable': true }.
TypeError: Plugin is not a constructor
Using CommonJS require() instead of ES import.
fix
Use import { Plugin } from 'graphdoc-plugin-schema'.
Upgrade
Version history
2.0.0latest on npm
Audit
Dependencies
@2fd/graphdocrequiredPeer dependency: required to generate documentation
Agent activity
8 hits · last 30 days
node
8
Resources
graphdoc-plugin-schema — npm install graphdoc-plugin-schema · libregistry