@antora-tools/graphql v0.9.0
@antora-tools/graphql
An extension for Antora to add pages extracted from a GraphQL schema.
Demo
Visit this url for a demo hosted on Github Pages.
Installation
npm install @antora-tools/graphqlEnable
antora:
extensions:
- require: '@antora-tools/graphql'
strategy: <Strategy>
location: <String>Or you can supply multiple configurations, for example:
antora:
extensions:
- require: '@antora-tools/graphql'
components:
- strategy: FILE
location: 'my-types.graphql'
- strategy: INTROSPECTION
location: 'https://host.com/graphql'Determine a strategy
Currently FILE, URL and INTROSPECTION are supported. To determine a strategy:
- Use
FILEwhen a GraphQL schema is accessible locally. Expects a relative path to one or more schema files. For example:./relative-path-to/schema.graphqlor./relative-path-to/*.graphql. - Use
URLwhen a GraphQL schema is accessible remotely via HTTP by POST or GET. Expects an URL to an endpoint that serves a.graphqlfile. For example:https://somehost.com/schema.graphqlorhttps://somehost.com/schema. - Use
INTROSPECTIONwhen a GraphQL endpoint is accessible remotely via HTTP by POST or GET. Expects an URL to a GraphQL endpoint. For example:https://somehost.com/graphql.
Configure for FILE
strategy: FILE
location: './files/*.graphql'Configure for URL
strategy: URL
location: 'https://somehost.com/schema'Configure for INTROSPECTION
strategy: INTROSPECTION
location: 'https://somehost.com/graphql'Optionally set HTTP request headers
headers:
- name: 'Authorization'
value: 'bearer 123456'Configuration keys
| Key | Type | Description |
|---|---|---|
| strategy* | string | Allowed values: FILE, URL or INTROSPECTION. |
| location* | string | Location for provided strategy. More info |
| name | string | Name for the component in lowercasing. Default: 'graphql'. |
| title | string | Title for the component. Default: 'GraphQL Api Docs'. |
| intro | string | Text to display on the index page. Supports asciidoc. |
| meta_file | string | Local path to a file containing extra meta data. More info |
| version | string | Version of the component. |
| display_version | string | Version to display. |
| headers | object | Name-value object to define headers for remote introspections. |
| include_styles | boolean | Include custom inline css at the bottom of each page. |
| ignore | string[] | Ignore all types that match one of the given expressions. |
| locale | string | Allowed values: de, en, es, or nl. Default: en. |
| log_level | string | Allowed values: all, debug, info, warn or error. Default: info. |
Fields marked with * are non-nullable.
location
When using FILE strategy it is recommended to use relative paths to the current working directory. Glob patterns are supported. Some examples:
- Single file
./dir/file.graphqldir/file.graphql
- Glob pattern
./dir/*.graphqldir/*.graphqldir/**/*.graphql
meta_file
A meta file can be used to customize some aspects of the generated output. For example the output of the introspection query, shown descriptions or template literals.
LOCALE
If your preferred locale is not supported; Most text in templates can be customized to your liking:
{
"LOCALE": {
"[key]": "[value]"
}
}Keys/Values
{
"arguments": "Arguments",
"definition": "Definition",
"downloads": "Downloads",
"enumValues": "Enum values",
"example": "Example",
"fields": "Fields",
"implementations": "Implementations",
"implementedBy": "Implemented by",
"inputFields": "Input fields",
"locations": "Locations",
"possibleTypes": "Possible types",
"repeatable": "Repeatable",
"request": "Request",
"returnType": "Return type"
}Development
Installation for local development
To start local development, run:
npm installServe and watch
To serve the Antora project in /e2e/project on localhost:8080 and watch for file changes in the src directory, run:
npm run serveUnit-testing
Unit-testing with jest.
npm teste2e-testing
E2e-testing with playwright.
npm run test:e2eInitially also run:
npx playwright install --with-deps chromiumChangelog
All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
0.9.0 - 2025-04-22
Added
- Support for "multi-config" to register multiple components simultaneously.
Removed
- Removed redundant
config.api_endpoint. Useconfig.introif you want to add asciidoc text to the index page.
0.8.0 - 2025-04-14
From now on installing this package is as simple as npm i @antora-tools/graphql.
Changed
- Moved
fieldsandinput-fieldspartials up in type templates. - Deprecated fields are now included in code examples.
Fixed
- Output return type for types with nested non nullables, for example
[Model!]!and[Model!], are now printed correctly.
Removed
- Removed dependencies:
@graphql-tools/load@graphql-tools/graphql-file-loader@graphql-tools/url-loader
0.7.0 - 2025-04-07
Added
- Support for
localeconfiguration. - Support for template localization using
LOCALEin the metafile. - Support for
enlocale. - Support for
nllocale. - Support for
delocale. - Support for
eslocale.
0.6.0 - 2025-03-17
Added
- Support for
meta_fileconfiguration.
0.5.0 - 2025-03-02
Added
- Code examples in
jsonformat inside type templates. - Code examples in
graphqlformat inside query, mutation and subscription templates.
0.4.0 - 2025-02-02
Added
- Support for
directives.
7 months ago
7 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago