mhallin / graphql-docs Goto Github PK
View Code? Open in Web Editor NEWGraphQL documentation explorer
License: MIT License
GraphQL documentation explorer
License: MIT License
I'm looking for some aspects of this project, I'm looking to contribute or find a solution that properly fits my needs.
The gist is, I just want to generate the static markdown from the command line. Is this possible with your project? Ideas? What do you think?
I have a UnionType in my schema, and when I view the docs via the React App I see: Error: Unsupported type ref kind: UNION
Generating via CLI also fails if the UNION type is present (no error displayed, just doesn't generate)
When I generate the docs via CLI with the union type removed from my Schema, the docs generate fine.
Got this message after did an html generation file :
graphql-docs-gen http://localhost:56911/v1/graphql documentation.html
Error coming from this block
var Schema = exports.Schema = function() {
function Schema(introspectionResult) {
var _this = this;
_classCallCheck(this, Schema);
if (!introspectionResult.__schema) { // here !
throw new Error('Function "Schema" precondition failed: introspectionResult.__schema');
}
If I run this from GraphiQL ->
query {
__schema {
queryType{
name
}
}
}
got this :
{
"data": {
"__schema": {
"queryType": {
"name": "query_root"
}
}
}
}
Any reason as to why input types are not documented ?
Hello,
I am trying to use this module to generate document for my GraphQL API. But I received this error:
d49cce02-13a4-11e6-8e2e-46e2b2239122.js:1 Uncaught (in promise) Error: Unsupported type ref kind: INPUT_OBJECT
I use GraphQL-Java as my backend but I guess things could also go wrong with node version.
Hi there,
Thanks for the nice module. I've promoted it on SO
Any thoughts on how to make it easier to use it in an isomorphic app context? On the server side I get:
***/node_modules/graphql-docs/dist/webpack:/~/style-loader/addStyles.js:31
if (typeof options.singleton === "undefined") options.singleton = isOldIE();
^
ReferenceError: window is not defined
Maybe related to #4 ?
Cheers,
Jun
Your comment says you can do it but no example, does it want a json file or an SD file or what? I can't get it to work
Right now I have this file in a utils.js somewhere on my server.
It would be sweet if I didn't need to rely on any other services here and really utilize the npm
dependency. This feels kind of hacky.
export let staticDocsHTML = () => {
return `
<!DOCTYPE html>
<html>
<head>
<title>GraphQL Docs</title>
</head>
<body>
<div id="app"></div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.0.2/react.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.0.2/react-dom.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/fetch/1.0.0/fetch.min.js"></script>
<script src="https://github.com/mhallin/graphql-docs/releases/download/v0.1.4/graphql-docs.min.js"></script>
<script>
function fetcher(query) {
return fetch(window.location.origin + '/graphql', {
method: 'POST',
headers: {
Accept: 'application/json',
'Content-Type': 'application/json',
},
body: JSON.stringify({
query: query,
}),
}).then(function(r) {
return r.json();
});
}
const rootElem = document.getElementById('app');
ReactDOM.render(
React.createElement(
GraphQLDocs.GraphQLDocs,
{
fetcher: fetcher,
}),
rootElem
);
</script>
</body>
</html>
`
}
<html>
<head>
<title>Docs</title>
<script src="https://unpkg.com/react@15/dist/react.js"></script>
<script src="https://unpkg.com/react-dom@15/dist/react-dom.js"></script>
<script src="https://github.com/mhallin/graphql-docs/releases/download/v0.2.0/graphql-docs.js"></script>
</head>
<body>
<div id="root"></div>
<script>
window.onload = function()
{
function fetcher(query) {
return fetch('http://localhost:3000/graphql', {
method: 'POST',
headers: {
Accept: 'application/json',
'Content-Type': 'application/json',
},
body: JSON.stringify({
query: query,
}),
}).then(function(r) {
return r.json();
});
}
ReactDOM.render(
React.createElement(GraphQLDocs.GraphQLDocs, { fetcher }),
document.getElementById('root')
);
};
</script>
</body>
</html>
I would like to use the static document generation but I have to set a http header (authorization).
Is that possible?
Hi there,
It would be great if some of the layout variables (particularly this 800px fixed width container) could be provided as a prop to the component!
Cheers,
Jun
Are union types not supported yet? I'm getting this error:
Uncaught (in promise) Error: Unsupported type ref kind: UNION
at Function.value (file:///Users/jgeller/Development/ng/clients/desktop/electron/output.html:15:6969)
at new t (file:///Users/jgeller/Development/ng/clients/desktop/electron/output.html:15:7164)
at Function.value (file:///Users/jgeller/Development/ng/clients/desktop/electron/output.html:15:6877)
at new v (file:///Users/jgeller/Development/ng/clients/desktop/electron/output.html:15:6546)
at file:///Users/jgeller/Development/ng/clients/desktop/electron/output.html:15:5419
at Array.map (native)
at new t (file:///Users/jgeller/Development/ng/clients/desktop/electron/output.html:15:5396)
at Function.value (file:///Users/jgeller/Development/ng/clients/desktop/electron/output.html:15:5029)
at file:///Users/jgeller/Development/ng/clients/desktop/electron/output.html:15:4309
at Array.forEach (native)
I already installed graphql-docs (globally) and now when I run below command
graphql-docs-gen MY-GRAPHQL-ENDPOINT doc.html
It returns with Did not get
HTTP 200 back from the endpoint error message.
Any idea how to fix it?
When I click an item and send it to someone and they visit the fragment in the url doesn't take them anywhere on the page.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.