https://github.com/interledger/astro-graphql-plugin
Astro plugin to generate Markdown documentation from a GraphQL schema
https://github.com/interledger/astro-graphql-plugin
Last synced: about 1 year ago
JSON representation
Astro plugin to generate Markdown documentation from a GraphQL schema
- Host: GitHub
- URL: https://github.com/interledger/astro-graphql-plugin
- Owner: interledger
- Created: 2024-04-25T02:33:16.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2025-01-30T11:21:04.000Z (over 1 year ago)
- Last Synced: 2025-03-20T17:04:15.894Z (about 1 year ago)
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/astro-graphql-plugin
- Size: 71.3 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# astro-graphql-plugin
Astro plugin generating Markdown documentation from a GraphQL schema. This plugin is modified off the [docusaurus-graphql-plugin](https://github.com/zhouzi/docusaurus-graphql-plugin) by [Gabin Aureche](https://github.com/zhouzi). If, for some reason, you need to check commits before version 0.2.0, please see the [git history of the previous version](https://github.com/interledger/deprecated-astro-graphql-plugin/commits/main).
## Usage
1. Install the plugin with the package manager of your choice. For example:
```
pnpm add astro-graphql-plugin
```
2. Add the plugin to `astro.config.mjs` and configure what the source schema, output directory and link prefix (for internal links generated to the output markdown). If you have multiple schemas, define them separately.
```js
import { defineConfig } from "astro/config";
export default defineConfig({
integrations: [
GraphQL({
schema: "/PATH_TO/schema1.graphql",
output: "./PATH_TO/output-dir1",
linkPrefix: "/URL_PATH_TO_GRAPHQL_DOCS_1",
}),
GraphQL({
schema: "/PATH_TO/schema2.graphql",
output: "./PATH_TO/output-dir2",
linkPrefix: "/URL_PATH_TO_GRAPHQL_DOCS_2",
}),
],
});
```
For this plugin, the API documentation is generated on build. If the schema.graphql file or any of the configuration options are updated, run the build step again to see the updates.