Comments (3)
Hi @GuiHash
That's definitively something I have missed when refactoring the schema loaders. Much needed.
I don't see a way to do it without a change in the code. But, a quick way to do it would be to add an optional parameter loaderOptions
(default = undefined) that accepts any object type (JSON format), then we can pass it directly to loadSchema()
in generateDocFromSchema()
:
const schema = await loadSchema(
schemaLocation,
{ loaders: getDocumentLoaders(loaders), },
loaderOptions
);
And enhancing the plugin config loaders format to:
type className = string; // UrlLoader
type moduleName = string; // "@graphql-tools/url-loader"
+ type moduleOptions = { [option: string]: any };
+ type module = {
+ module: moduleName,
+ options: moduleOptions | undefined
+ }
type loaders = {
- [className: className]: moduleName
+ [className: className]: moduleName | module
}
Please go ahead and submit a PR 🚀
from graphql-markdown.
Released in 1.5.3
from graphql-markdown.
Hey! I'm sorry to revive this, but I don't really understand the implementation there. It seems all the options passed are moved to an object called loaderOptions
which is then passed as is into the options that the graphql-tools
loader takes. This is how the options look like then:
{
loaders: [ UrlLoader {} ],
loaderOptions: { headers: { 'x-api-key': 'xxx' } },
filterKinds: [ 'OperationDefinition', 'FragmentDefinition' ],
ignore: [],
cache: {},
cwd: '/home/chris/dev/colony/docs',
sort: true
}
Though I think the loaderOptions
need to be merged into this object, not included. Or am I doing anything horribly wrong?
EDIT: It might be a regression. Here's the original PR which merges the loaderOptions:
Here's the current code which just passes it in:
graphql-markdown/packages/core/src/generator.js
Lines 89 to 90 in b828b00
from graphql-markdown.
Related Issues (20)
- groupByDirective option is not working with @graphql-tools/url-loader as schema loader. HOT 4
- Add metadata to autogenerated docs HOT 2
- improve build chain HOT 1
- Typedoc improvements
- Compatibility with Docusaurus v3
- Upgrade website to Docusaurus v3
- Adjustments for Docusaurus v3 HOT 7
- Optional categories
- Custom Types (AWSDate, AWSDateTime) and graphql codegen Compatibility HOT 1
- Support generating pages in draft mode HOT 6
- COMMAND deprecated in Earthly 0.8
- Json File Loader - Introspection Query Input HOT 2
- Separate API from Types
- support examples
- Add note about mutation tests in CONTRIBUTING.md
- Indentation level in code section HOT 2
- SonarCloud analysis not running HOT 1
- Add documentation for packages HOT 4
- Add print option to hide code blocks HOT 3
- Only show queries/mutations based on directive HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from graphql-markdown.