graphql / swapi-graphql Goto Github PK
View Code? Open in Web Editor NEWA GraphQL schema and server wrapping SWAPI.
Home Page: http://graphql.org/swapi-graphql/
License: MIT License
A GraphQL schema and server wrapping SWAPI.
Home Page: http://graphql.org/swapi-graphql/
License: MIT License
Could you expose the API without the GraphiQL interface?
So other people can send requests to the SWAPI GraphQL endpoint in order to tests GraphQL Clients.
npm install
will not work on MS Windows 10. The system ins not able to set Environment Variable NODE_ENV
Please make swapi-graphql work with Windows 10.
swapi-graphql
directorynpm install
Error will occur:
> swapi-graphql@ build:lambda D:\z_git_jj\_graphql\swapi-graphql
> NODE_ENV=development netlify-lambda build handler
Der Befehl "NODE_ENV" ist entweder falsch geschrieben oder konnte nicht gefunden werden.
Translation: The Command "NODE_ENV" is either misspelled or could not be found.
npm install cross-env
package.json
"build:lambda"
- Add cross-env before setting variablenpm install
package.json:
"build:lambda": "cross-env NODE_ENV=development netlify-lambda build handler",
Stackoverflow: How to set environment variables from within package.json
Branch | Build failing π¨ |
---|---|
Dependency | prettier |
Current Version | 1.3.1 |
Type | devDependency |
This version is covered by your current version range and after updating it in your project the build failed.
As prettier is βonlyβ a devDependency of this project it might not break production or downstream projects, but βonlyβ your build or test tools β preventing new deploys or publishes.
I recommend you give this issue a high priority. Iβm sure you can resolve this πͺ
This is the most requested feature for prettier. With 1.4.0, you can now use prettier to format your .ts
and .tsx
files!
The way prettier works is by using those project to generate an AST representation of the code and print it. Both babylon (the parser that powers babel) and flow are producing an AST approximately following the estree format for the JavaScript parts and then have special nodes for Flow-specific ones.
TypeScript, the same way as Flow, introduces special nodes for the syntax it introduces. Unfortunately, it doesn't follow the estree format for the rest of the JavaScript language. This puts us in a rough spot with prettier as we would have to essentially completely fork it in order to print TypeScript.
This incompatibility with the AST is not a new problem and another project struggled with it: ESLint. Because the AST is different, none of the ESLint rules are working. Fortunately for us, @JamesHenry and @soda0289 wrote a project called typescript-eslint-parser which takes a TypeScript AST and convert it to an estree one, just what we need for prettier!
After that project got setup inside of prettier, @azz, @despairblue and @Pajn implemented all the TypeScript-specific nodes and ensured that the 13k tests of the TypeScript test suite are correctly passing. This was a huge undertaking and it is finally ready to be used :)
We tested prettier on the biggest TypeScript projects we could find on GitHub to ensure that it prints correct code. We haven't spent a lot of time trying to optimize the way code is formatted yet, so if you see something strange, please raise an issue!
While TypeScript is the most requested feature from open source, CSS is the biggest one from Facebook engineers. Once you are used to pretty print your code in one language, you want to do it everywhere!
It turns out that CSS is a much smaller language than JavaScript and supporting it only took a few days. We are using postcss by @ai as the underlying parser which is able to parse CSS, Less and SCSS. We also depend on postcss-values-parser, postcss-selector-parser by @ben-eb postcss-media-query-parser by @dryoma.
Unfortunately, postcss right now doesn't parse Sass nor Stylus. We'd be happy to support them if someone is willing to do the work of printing them.
Note that prettier is currently just formatting the code, it does not respect any options yet such as singleQuote
nor is doing any color or number normalization like we do for JavaScript.
The first phase of the project was to make prettier output correct and good looking code. Now that it's in a good shape, we can spend time on making the integrations better. We just introduced support for two great features: maintain cursor position and being able to format a range instead of the entire file.
Note that we just landed the support inside of prettier itself, none of the editor integrations are using it yet. Also, we haven't really tried them out in practice so we're likely going to have to fix rough edges with them!
cursorOffset
option for cursor translation (#1637) by @josephfrazierRight now, we let editors figure out where the cursor should be, which they do an okay job at. But since we are printing the code, we can give the correct position!
--range-start/end
options to format only parts of the input (#1609) by @josephfrazierThis one is a very often requested feature. Right now prettier only formats the entire file. Now it is possible to format a range.
The way it works is by going up through the AST in order to find the closest statement. This way you don't need to select exactly the right range that is valid. You can just drag in the rough place where the code you want to reformat it, and it's going to!
Since we are now formatting CSS and TypeScript, it is not convenient to have to specify the parser for every file. You can now pass the filepath of the file you are working on and prettier will read the extension and figure out the right parser to use.
The biggest remaining issue that people have with prettier when printing JSX is when it is used when printing text. The behavior of prettier used to add an ugly {" "}
before and if a line was too long, just leave it alone. Now we treat each word as a token and are able to make it flow correctly.
This is an awesome piece of work by @karl as not only did he implement the feature, but also introduced a new primitive inside of prettier in order to print a sequence of elements and break as soon as one hits the edge.
// Before <div> Please state your {" "} <b>name</b> {" "} and {" "} <b>occupation</b> {" "} for the board of directors. </div>// After
<div>
Please state your <b>name</b> and <b>occupation</b> for the board of
directors.
</div>
People writing functional components are going to be happy about this one. We no longer put parens for arrow functions that return JSX.
// Before const render1 = ({ styles }) => ( <div style={styles}> Keep the wrapping parens. Put each key on its own line. </div> );// After
const render1 = ({ styles }) =>
<div style={styles}>
Keep the wrapping parens. Put each key on its own line.
</div>;
Template literal printing has always caused prettier a lot of difficulties. With 1.3.0 we massively improved the situation and with this release, I believe that we handle all the common situations in a good way.
In order to workaround issues, we added an utility that removes empty lines from the output, but it yielded some really weird results sometimes, this is now gone. Another tweak we've done is instead of indenting when ${
starts, we indent where the line that contains ${
starts.
Let us know if you still have issues with how template literals output after this release!
// Before const Bar = styled.div` color: ${props => (props.highlight.length > 0 ? palette([ 'text', 'dark', 'tertiary' ])(props) : palette([ 'text', 'dark', 'primary' ])(props))} !important; `// After
const Bar = styled.div</span></span> <span class="pl-s"> color: <span class="pl-s1"><span class="pl-pse">${</span><span class="pl-smi">props</span> <span class="pl-k">=></span></span></span> <span class="pl-s"><span class="pl-s1"> <span class="pl-smi">props</span>.<span class="pl-smi">highlight</span>.<span class="pl-c1">length</span> <span class="pl-k">></span> <span class="pl-c1">0</span></span></span> <span class="pl-s"><span class="pl-s1"> <span class="pl-k">?</span> <span class="pl-en">palette</span>([<span class="pl-s"><span class="pl-pds">"</span>text<span class="pl-pds">"</span></span>, <span class="pl-s"><span class="pl-pds">"</span>dark<span class="pl-pds">"</span></span>, <span class="pl-s"><span class="pl-pds">"</span>tertiary<span class="pl-pds">"</span></span>])(props)</span></span> <span class="pl-s"><span class="pl-s1"> <span class="pl-k">:</span> <span class="pl-en">palette</span>([<span class="pl-s"><span class="pl-pds">"</span>text<span class="pl-pds">"</span></span>, <span class="pl-s"><span class="pl-pds">"</span>dark<span class="pl-pds">"</span></span>, <span class="pl-s"><span class="pl-pds">"</span>primary<span class="pl-pds">"</span></span>])(props)<span class="pl-pse">}</span></span> !important;</span> <span class="pl-s"><span class="pl-pds">
We have a lot of fine-tuned logic for how to break things after assignment (eg a = ...
). We are now using the same one for object values. This should help for multi-line boolean logic, or big conditionals. This is also a good example of how we can create a consistent printer.
// Before const o = { somethingThatsAReallyLongPropName: this.props.cardType === AwesomizerCardEnum.SEEFIRST, };// After
const o = {
somethingThatsAReallyLongPropName:
this.props.cardType === AwesomizerCardEnum.SEEFIRST,
};
There's been a steady stream of people complaining about the way it was rendered and was put on the list of things that are probably hard to do, will check later. It turned out to be super easy, so here you go!
// Before const anyTestFailures = !(aggregatedResults.numFailedTests === 0 && aggregatedResults.numRuntimeErrorTestSuites === 0);// After
const anyTestFailures = !(
aggregatedResults.numFailedTests === 0 &&
aggregatedResults.numRuntimeErrorTestSuites === 0
);
We were already doing this for if statements, we should be consistent and also do it for loops.
// Before for (a in b) var c = {};// After
for (a in b) var c = {};
We shouldn't indent things twice ;)
// Before type Foo = Promise<<span class="pl-k">|</span> { ok<span class="pl-k">:</span> <span class="pl-c1">true</span>, bar<span class="pl-k">:</span> string, baz<span class="pl-k">:</span> SomeOtherLongType } <span class="pl-k">|</span> { ok<span class="pl-k">:</span> <span class="pl-c1">false</span>, bar<span class="pl-k">:</span> SomeOtherLongType }
>;
// After
type Foo = Promise<
{ ok: true, bar: string, baz: SomeOtherLongType } |
{ ok: false, bar: SomeOtherLongType }
>;Do not put parens for single argument with end of line comment (#1518)
The detection code for whether an arrow function should be written without parenthesis just checked if there was a comment, but instead we only want comments that are inline like
(/* comment */ num)
, not end of line comments.// Before KEYPAD_NUMBERS.map((num) => ( // Buttons 0-9 <div /> ));KEYPAD_NUMBERS.map(num => ( // Buttons 0-9
<div />
));Do not indent nested ternaries (#1822)
This avoids making it seems like it is indented by 4 characters instead of two. The downside is that if the condition is multi-line it's not going to be properly aligned, but I feel it's a better trade-offs. If you are doing nested ternaries, you usually have small conditions.
// Before aaaaaaaaaaaaaaa ? bbbbbbbbbbbbbbbbbb : ccccccccccccccc ? ddddddddddddddd : eeeeeeeeeeeeeee ? fffffffffffffff : gggggggggggggggg;// After
aaaaaaaaaaaaaaa
? bbbbbbbbbbbbbbbbbb
: ccccccccccccccc
? ddddddddddddddd
: eeeeeeeeeeeeeee ? fffffffffffffff : gggggggggggggggg;Inline chained conditionals inside of jsx attribute (#1519)
We don't need to use the indentation to disambiguate another block as nothing can come after.
// Before <div src={ !isEnabled && diffUpdateMessageInput != null && this.state.isUpdateMessageEmpty } />;// After
<div
src={
!isEnabled &&
diffUpdateMessageInput != null &&
this.state.isUpdateMessageEmpty
}
/>;Unescape unnecessarily escaped characters in strings (#1575) by @josephfrazier
We are already trying to cleanup strings in various ways, this is another small addition that's going to remove
\
that are not needed.// Before a = 'hol\a';// After
a = 'hola';Fix boolean for empty objects (#1590) by @dmitrika
We want to inline objects inside of a boolean expression as it looks weird to have
{
on its own line. But it turns out that it leads to weird behaviors for empty objects. So we keep them on their own line if they are empty.const x = firstItemWithAVeryLongNameThatKeepsGoing || secondItemWithALongNameAsWell || {};// After
const x =
firstItemWithAVeryLongNameThatKeepsGoing ||
secondItemWithALongNameAsWell ||
{};Remove Parens from SequenceExpressions in ForStatements (#1597) by @k15a
It is common to assign multiple values inside of a for loop, now we don't add parenthesis anymore.
// Before for ((i = 0), (len = arr.length); i < len; i++) {// After
for (i = 0, len = arr.length; i < len; i++) {Do not inline arrow when argument has a leading comment (#1660)
If you put block comments inside of arrow functions, we no longer mess everything up!
// Before export const bem = block => /** * @param {String} [element] - the BEM Element within that block; if undefined, selects the block itself. */ element => /** * @param {?String} [modifier] - the BEM Modifier for the Block or Element; if undefined, selects the Block or Element unmodified. */ modifier =>// After
export const bem = block =>
/
* @param {String} [element] - the BEM Element within that block; if undefined, selects the block itself.
*/
element =>
/
* @param {?String} [modifier] - the BEM Modifier for the Block or Element; if undefined, selects the Block or Element unmodified.
*/
modifier =>Fix last comments of imports (#1677)
Another place where we have to do special logic for comments!
// Before import { ExecutionResult, DocumentNode, /* tslint:disable */ SelectionSetNode, } /* tslint:enable */ from 'graphql';// After
import {
DocumentNode,
/* tslint:disable /
SelectionSetNode,
/ tslint:enable */
} from 'graphql';Handle comments in member chain (#1686, #1691)
We handled some placements before and kept adding places where they could appear, now we switch to a more general approach. Hopefully those issues shouldn't crop up in the future anymore.
// Before const configModel = this.baseConfigurationService.getCache().consolidated // global/default values (do NOT modify) .merge(this.cachedWorkspaceConfig);// After
const configModel = this.baseConfigurationService
.getCache()
.consolidated // global/default values (do NOT modify)
.merge(this.cachedWorkspaceConfig);Use expandLast for nested arrow functions (#1720)
// Before f(action => next => next(action));// After
f(action => next =>
next(action),
);Put JSX comments inside of the parenthesis (#1712)
This mostly affects Facebook engineers where we automatically add
$FlowFixMe
when pushing a new version of flow. Now it no longer messes up those comments.// Before const aDiv = /* $FlowFixMe */ ( <div className="foo"> Foo bar </div> );// After
const aDiv = (
/* $FlowFixMe */
<div className="foo">
Foo bar
</div>
);Force \n for multiple variable declarations (#1723)
This one has been very often requested. We used to only break multiple variable declarations if the line was > 80 columns. Now we do it regardless if there's at least one with an assignment.
// Before var numberValue1 = 1, numberValue2 = 2;// After
var numberValue1 = 1,
numberValue2 = 2;Inline | null and | void (#1734)
The expanded version of flow union looks good when they are many objects but if it's used for nullability, the it looks very weird. We're now inlining
| null
and| void
.// Before interface RelayProps { articles: | Array< | { __id: string, } | null > | null }// After
interface RelayProps {
articles: Array<{
__id: string,
} | null> | null,
}Break on implements instead of extends (#1730)
We no longer break on
extends
. This should make classes with extends that can break look less wonky.// Before class MyContractSelectionWidget extends React.Component< void, MyContractSelectionWidgetPropsType, void > { method() {} }// After
class MyContractSelectionWidget extends React.Component<
void,
MyContractSelectionWidgetPropsType,
void
> {
method() {}
}Inline single import (#1729)
The same way we don't break long
require
calls, we no longer breakimport
statements if there is only a single thing being imported.// Before import somethingSuperLongsomethingSuperLong from "somethingSuperLongsomethingSuperLongsomethingSuperLong";// After
import somethingSuperLongsomethingSuperLong from "somethingSuperLongsomethingSuperLongsomethingSuperLong";Add the ability for SequenceExpression to break (#1749)
Did you know that if none of your code were statements, you could use
()
instead of{}
and,
instead of;
? Now you do. Some people exploit this fact when returning things from arrow functions. This is not recommended but it's easy to support in prettier so might as well Β―_(γ)_/Β―// Before const f = (argument1, argument2, argument3) => (doSomethingWithArgument(argument1), doSomethingWithArgument( argument2 ), argument1);// After
const f = (argument1, argument2, argument3) => (
doSomethingWithArgument(argument1),
doSomethingWithArgument(argument2),
argument1
);Don't force line break in empty loop bodies (#1815)
Loops with empty body no longer have their
{}
split into two lines.// Before while (true) { }// After
while (true) {}Preserve empty lines between switch cases with comments (#1708)
// Before switch (true) { case true: // Good luck getting here case false: }// After
switch (true) {
case true:// Good luck getting here
case false:
}Correctness
Remove ast-types (#1743, #1744, #1745, #1746, #1747)
We used to find where to put comments by traversing the AST using the definition from ast-types. This occasionally caused issues when some field wasn't declared, we wouldn't find the node and either print comments in an incorrect location or throw an error. It turns out that we don't need to keep this mapping and can just traverse the objects and if a node has a
type
field, then it's a node.// Before Error: did not recognize object of type "ObjectTypeSpreadProperty"// After
type X = {...Y//};
type X = {//...Y};Preserve unusual unicode whitespace (#1658, #1165) by @karl and @yamafaktory
If you were adding invisible characters inside of JSX text, we would replace them by regular spaces. I don't know why anyone would ever want to do that, but now we print it back as is!
Don't let trailing template literal comments escape (#1580, #1713, #1598, #1713) by @josephfrazier and @k15a
We used to have some pretty complicated (and not working well) code to handle comments inside of template literals. We introduced a really nice solution for JSX
{}
expressions. The idea is to introduce a boundary before the end of the}
and if we still have unprinted comments, then flush them all at once, put a \n and print the}
. We are now using this logic for template literals :)// Before `${0} // comment`;// After
</span><span class="pl-s1"><span class="pl-pse">${</span></span></span> <span class="pl-s"><span class="pl-s1"><span class="pl-c1">0</span></span></span> <span class="pl-s"><span class="pl-s1"><span class="pl-c"><span class="pl-c">//</span> comment</span></span></span> <span class="pl-s"><span class="pl-s1"><span class="pl-pse">}</span></span><span class="pl-pds">
;Parenthesize await correctly (#1513, #1595, #1593) by @bakkot and @existentialism
We don't have an automated way to put parenthesis, we instead specify all the possible combinations of nodes and when they should or shouldn't have parenthesis. So there's likely a long tail of unusual combinations that are still remaining. In this case, we made
await
handling a lot more robust by both adding parenthesis where they are needed and removing them when they are not.// Before (await spellcheck) && spellcheck.setChecking(false); new A((await x));// After
await (spellcheck && spellcheck.setChecking(false));
new A(await x);Preserve getter/setter info on flow ObjectTypeProperty (#1585) by @josephfrazier
Another long tail option that we haven't got right!
// Before type T = { method: () => void };// After
type T = { get method(): void }Add parenthesis for single arg types with generics (#1814)
Another case of sneaky parenthesis that we didn't properly add!
// Before type ExtractType = <A>B<C> => D// After
type ExtractType = <A>(B<C>) => DFall back to non-strict mode in babylon (#1587, #1608) by @josephfrazier
We want prettier to be able to parse all the JavaScript out there. For babylon parser, we have to chose whether a file is using strict mode or not. We opted in to use strict mode by default as most files parse that way. But if you have octal literals like
0775
, it would not even parse. Now if it fails to parse in strict mode, we're going to try again in non-strict. We also allowreturn
outside of a function as it's valid in node files.// Before SyntaxError// After
return 0775;CLI
Allow
--write
to be used with--list-different
(#1633)This is useful to combine the two if you are writing a commit hook to tell the user what actually changed in a single command.
Ignore node_modules when running prettier from CLI (#1683) by @thymikee
It's very easy to run prettier over the
node_modules/
folder by mistake which is something you almost never want to. So now we disable it by default and add a--with-node-modules
option if you really want to.Traverse dot files for glob (#1844) by @jhgg
We enabled the option to go through .dotfiles in the glob parsing library we are using. This means that writing
*
will now catch.eslintrc
.Not sure how things should work exactly?
There is a collection of frequently asked questions and of course you may always ask my humans.
Your Greenkeeper Bot π΄
Folks, just a heads up that we'll be swapping the primary branch from master to main. GitHub's tooling will remap any open PRs. If you're working locally and all your code has been merged, you can either reset your origin (GitHub will provide an instruction) or just do a fresh clone.
cc/ @leebyron
Branch | Build failing π¨ |
---|---|
Dependency | babel-eslint |
Current Version | 7.2.0 |
Type | devDependency |
This version is covered by your current version range and after updating it in your project the build failed.
As babel-eslint is βonlyβ a devDependency of this project it might not break production or downstream projects, but βonlyβ your build or test tools β preventing new deploys or publishes.
I recommend you give this issue a high priority. Iβm sure you can resolve this πͺ
The new version differs by 6 commits .
3cda62e
7.2.1
5626de1
Remove left over eslint 2 estraverse code (#452)
b5fb53b
Fix type param and interface declaration scoping (#449)
f1cee0f
Remove lodash dependency (#450)
eb05812
Format non-regression errors for legibility (#451)
7972a05
Update README.md with codeFrame option (#448)
See the full diff.
There is a collection of frequently asked questions and of course you may always ask my humans.
Your Greenkeeper Bot π΄
Hi! Similar to what I reported in GraphQLHub, any client using graphql 0.5.0 or later is incompatible with this server. Do you intend to upgrade it? Right now, I don't know any public GraphQL API compatible with a recent graphql
package version (currently 0.7.1
).
Looks like this https://graphql.org/swapi-graphql is not working any more?
npm run start fails. I initially thought it was because I'm using node v7.0.0 , so I switched nvm to use node v6.9.1 and it still failed.
Heres the error:
> swapi-graphql@ start /Users/kennetpostigo/Projects/greed/docs/swapi-graphql
> npm run download && babel-node src/cloud/main.js
> swapi-graphql@ download /Users/kennetpostigo/Projects/greed/docs/swapi-graphql
> if [ ! -f src/api/cachedData/cache.js ]; then echo 'Downloading cache...' && node src/api/cachedData/downloadCache.js > src/api/cachedData/cache.js && echo 'Cached!'; fi;
/Users/kennetpostigo/Projects/greed/docs/swapi-graphql/node_modules/babel-core/lib/transformation/file/options/option-manager.js:126
if (!option) this.log.error("Unknown option: " + alias + "." + key, ReferenceError);
^
TypeError: Cannot read property 'error' of undefined
at OptionManager.mergeOptions (/Users/kennetpostigo/Projects/greed/docs/swapi-graphql/node_modules/babel-core/lib/transformation/file/options/option-manager.js:126:28)
at OptionManager.addConfig (/Users/kennetpostigo/Projects/greed/docs/swapi-graphql/node_modules/babel-core/lib/transformation/file/options/option-manager.js:107:10)
at OptionManager.findConfigs (/Users/kennetpostigo/Projects/greed/docs/swapi-graphql/node_modules/babel-core/lib/transformation/file/options/option-manager.js:168:35)
at OptionManager.init (/Users/kennetpostigo/Projects/greed/docs/swapi-graphql/node_modules/babel-core/lib/transformation/file/options/option-manager.js:229:12)
at compile (/Users/kennetpostigo/Projects/greed/docs/swapi-graphql/node_modules/babel-core/lib/api/register/node.js:117:22)
at normalLoader (/Users/kennetpostigo/Projects/greed/docs/swapi-graphql/node_modules/babel-core/lib/api/register/node.js:199:14)
at Object.require.extensions.(anonymous function) [as .js] (/Users/kennetpostigo/Projects/greed/docs/swapi-graphql/node_modules/babel-core/lib/api/register/node.js:216:7)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
Hi, there is a way, a public endpoint, to get this GraphQL Schema using Relay or Apollo (or another client)?
Some errors of late have only been caught by manually running npm test
(which runs eslint, flow and the test suite).
Branch | Build failing π¨ |
---|---|
Dependency | browserify |
Current Version | 14.0.0 |
Type | devDependency |
This version is covered by your current version range and after updating it in your project the build failed.
As browserify is βonlyβ a devDependency of this project it might not break production or downstream projects, but βonlyβ your build or test tools β preventing new deploys or publishes.
I recommend you give this issue a high priority. Iβm sure you can resolve this πͺ
The new version differs by 3 commits .
06a47d1
14.1.0
67ea8b1
Merge branch 'patch-1' of https://github.com/natevw/node-browserify
ea6c299
Write to temp outfile until success, fixes #899
See the full diff.
There is a collection of frequently asked questions and of course you may always ask my humans.
Your Greenkeeper Bot π΄
Reposting from graphql/graphiql#834. The link gives a Page Not Found error:
We should either wrap this demo up to be browser-contained and run from gh-pages, or deploy to heroku or something since Parse is shutting down in the future.
When you try and run as query on http://swapi.graphene-python.org/graphql. You get the following message.
"message": "(1862, 'Your password has expired. To log in you must change it using a client that supports expired passwords.')",
Hello am getting this error when trying to get an introspection of your graphql api using graphql voyager
Access to fetch at 'https://graphql.org/swapi-graphql' from origin 'http://localhost:3000' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
Could you kindly assist me or tell me why am getting this error?
Hi,
I can't find the way to search films by title (https://swapi.dev/api/films/?search=hope), is there any way to do it with query?
Thanks in advance
You have an outdated instance of this proxy hosted on:
http://graphql-swapi.parseapp.com/
Can you please update it to the latest version.
Having example GraphQL server helps a lot when you develop tooling for GraphQL.
+ many developers like to send queries from cURL, Postman, source code, etc.
I may be missing something, but in attempting to do joins based on films and vehicle connections I get duplicate vehicles. Is the demo implementation incorrect or is my query syntax incorrect?
{
allFilms(first: 3) {
films {
title
vehicleConnection {
vehicles {
id
name
}
}
}
}
}
Link to live demo with query populated
The result lists the same vehicle multiple times within a single movie:
{
"data": {
"allFilms": {
"films": [
{
"title": "A New Hope",
"vehicleConnection": {
"vehicles": [
{
"id": "dmVoaWNsZXM6NA==",
"name": "Sand Crawler"
},
{
"id": "dmVoaWNsZXM6Ng==",
"name": "T-16 skyhopper"
},
{
"id": "dmVoaWNsZXM6Nw==",
"name": "X-34 landspeeder"
},
{
"id": "dmVoaWNsZXM6OA==",
"name": "TIE/LN starfighter"
},
{
"id": "dmVoaWNsZXM6NA==",
"name": "Sand Crawler"
},
{
"id": "dmVoaWNsZXM6Ng==",
"name": "T-16 skyhopper"
}, ...
Am I missing something?
Note: This links to a closed issue because I realized this was the repo for the Star Wars GraphQL wrapper around swapi.org used in the demo site and so moved my issue here. I still can't make sense of the result I am getting.
C:\swapi-graphql-master\scripts\pretty.js:36
const out = stdout.toString().trim();
^
TypeError: Cannot read property 'toString' of null
at Object. (C:\swapi-graphql-master\scripts\pretty.js:36:20)
at Module._compile (module.js:635:30)
at Object.Module._extensions..js (module.js:646:10)
at Module.load (module.js:554:32)
at tryModuleLoad (module.js:497:12)
at Function.Module._load (module.js:489:3)
at Function.Module.runMain (module.js:676:10)
at startup (bootstrap_node.js:187:16)
at bootstrap_node.js:608:3
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! swapi-graphql@ pretty-check: node scripts/pretty.js --check
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the swapi-graphql@ pretty-check script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\kmema\AppData\Roaming\npm-cache_logs\2017-11-13T03_07_21_469Z-debug.log
npm ERR! Test failed. See above for more details.
I am learning how to use GraphQL and connect with my android Application. But I am getting an error on npm test command. Am I supposed to run this command in any specific folder. And also I another issue with creating Schema.json file for my android app for variant debug purpose
It would be grand to add more examples to the schema of new features we have. That way, we can fully demonstrate the features of GraphiQL, etc to newcomers!
high priority:
all else:
Is there a plan maybe for dependencies - most notably babel - to be updated?
npm install
added 666 packages in 86.589s
C:\swapi-graphql-master>npm start
swapi-graphql@ start C:\swapi-graphql-master
npm run download && babel-node src/server/main.js
swapi-graphql@ download C:\swapi-graphql-master
sh scripts/download
'sh' is not recognized as an internal or external command,
operable program or batch file.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! swapi-graphql@ download: sh scripts/download
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the swapi-graphql@ download script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\kmema\AppData\Roaming\npm-cache_logs\2017-11-11T10_11_37_124Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! swapi-graphql@ start: npm run download && babel-node src/server/main.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the swapi-graphql@ start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\kmema\AppData\Roaming\npm-cache_logs\2017-11-11T10_11_37_279Z-debug.log
I can't use GraphiQL at http://graphql-swapi.parseapp.com/, could it be the same issue I'm experiencing there graphql/express-graphql#34 ?
Thank you!
Branch | Build failing π¨ |
---|---|
Dependency | browserify |
Current Version | 14.1.0 |
Type | devDependency |
This version is covered by your current version range and after updating it in your project the build failed.
As browserify is βonlyβ a devDependency of this project it might not break production or downstream projects, but βonlyβ your build or test tools β preventing new deploys or publishes.
I recommend you give this issue a high priority. Iβm sure you can resolve this πͺ
The new version differs by 5 commits .
18e1d65
14.2.0
0e1a7a0
add cli support for --transform-key to support mode's like production/staging/etc..
a5aa660
Merge pull request #1701 from wogsland/doc-fix
ae281bc
Fixed documentation formatting that was bugging me
fe8c57b
async test for node 7
See the full diff.
There is a collection of frequently asked questions and of course you may always ask my humans.
Your Greenkeeper Bot π΄
Branch | Build failing π¨ |
---|---|
Dependency | babel-core |
Current Version | 6.23.0 |
Type | devDependency |
This version is covered by your current version range and after updating it in your project the build failed.
As babel-core is βonlyβ a devDependency of this project it might not break production or downstream projects, but βonlyβ your build or test tools β preventing new deploys or publishes.
I recommend you give this issue a high priority. Iβm sure you can resolve this πͺ
There is a collection of frequently asked questions and of course you may always ask my humans.
Your Greenkeeper Bot π΄
The UI at https://graphql.org/swapi-graphql doesn't seem to work anymore. Is it ever coming back?
Hello, thanks to make this up, it gave me a lot inspiration on designing my GraphQL schema.
I encountered a circular reference problem while building my Schema and still after hours of debug i couldn't find the reason, you might help me out to understand.
I have the following GraphQLObjectTypes
types/Serie.js
import {
...
} from "graphql";
import Graphus from "./../graphus";
import CategoryType from "./Category";
const Serie = Graphus.createModelType('serie', {
title: { type: new GraphQLNonNull(GraphQLString) },
title_seo: { type: new GraphQLNonNull(GraphQLString) },
trama: { type: new GraphQLNonNull(GraphQLString) },
vote_count: { type: GraphQLInt },
images: {
type: new GraphQLObjectType({
name: 'SerieImages',
fields: () => ({
profile: { type: GraphQLString },
cover: { type: GraphQLString },
background: { type: GraphQLString }
})
})
},
season_count: { type: GraphQLInt },
categories: Graphus.createConnection('serie', 'category', CategoryType, {
as: 'categories'
}).connectChild(),
});
export default Serie;
types/Category.js
import {
...
} from "graphql";
import Graphus from "./../graphus";
import SerieType from "./Serie";
console.log(SerieType); // undefined :(
const Category = Graphus.createModelType('category', {
name: {
type: new GraphQLNonNull(GraphQLString)
},
description: {
type: new GraphQLNonNull(GraphQLString)
},
series: Graphus.createConnection('category', 'serie', SerieType, {
as: 'series'
}).connectChild()
});
export default Category;
How you could notice SerieType
has a categories
fields which require CategoryType
and the same thing for the CategoryType
which require SerieType
in a many to many
relationship.
Graphus.createModelType
returns a GraphQLObjectType Instance
Graphus.createConnection
return a relay connection similar to connectionFromUrl
Looking trough the repo source, I noticed that you do the same thing but it doesn't cause any problem.
Ex: FilmType
import PersonType
and PersonType
uses FilmType
If you have any hints on what might cause in my case, that when importing SerieType
on CategoryType
it give undefined would be appreciated.
PS: if only 1 of the type require the other, the schema is built corrected
// film.js
import PersonType from './person';
// person.js
import FilmType from './film';
Are these circular deps an acceptable practice? Are there any good patterns for avoiding this? It seems bad to include problematic practices in the definitive demo for GraphQL.
I was wondering if there was a specific reason as to why there are connection types. For instance, consider the following query:
{
person(personID: 1) {
filmConnection {
films {
title
}
}
}
}
It would seem more intuitive to me to have something like the following:
{
person(personID: 1) {
films {
title
}
}
}
The latter is how I recently constructed a graphql schema of my own, so I was wondering what the motivation was behind the connection types.
npm run download fails. Will fix it in a PR
π Netlify is failing. Need to investigate this
cc @IvanGoncharov
Originally posted by @saihaj in #182 (comment)
Hello,
Do you think it would be ok to add a header Access-Control-Allow-Origin: *
?
It might allow other GraphQL projects to use the same graph for example purposes.
Continuation of #49.
Hosted GraphiQL is a great solution for introducing new users to GraphQL.
However many GraphQL tools designed to work with 3rd-party GraphQL APIs so in order to provide a demo or example they need to host they own server.
For our GraphQL Fakerl we host SWAPI under https://swapi.apis.guru domain.
Problem is that create a barrier for tooling author since hosting your own server requires time and money investments.
This being the premier GraphQL example, I expected the schema to be defined (and documented) in a GraphQL schema file. Or maybe I overlooked something? If not, it would be nice to have to support languages other than JS. Thanks!
I was just curious why the sample queries from here http://graphql.org/learn/ don't work on your graphiQL instance.
for example, if I run
{
hero {
name
}
}
I get "Cannot query field \"hero\" on type \"Root\". Did you mean \"person\"?",
Looks like there's a regression: This query used to work but now returns error No entry in local cache for [object Object]
#b0a73b6 Seems to be ok, so it happened at some point since then
The demo at http://graphql.org/swapi-graphql is broken. I receive a "Failed to fetch" message in the GraphiQL output window and a CORS policy error in the browser console when loading the page.
When attempting to run npm run download
, I received the following output:
swapi-graphql@ download /Users/lizborchardt/swapi-graphql
sh scripts/downloadDownloading cache...
/Users/lizborchardt/swapi-graphql/src/api/cachedData/downloadCache.js:54
let url = prefix + urlTypes[type] + '/';
^^^SyntaxError: Block-scoped declarations (let, const, function, class) not yet supported outside strict mode
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:373:25)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Function.Module.runMain (module.js:441:10)
at startup (node.js:139:18)
at node.js:974:3npm ERR! Darwin 16.4.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "download"
npm ERR! node v4.6.1
npm ERR! npm v2.15.9
npm ERR! code ELIFECYCLE
npm ERR! swapi-graphql@ download:sh scripts/download
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the swapi-graphql@ download script 'sh scripts/download'.
npm ERR! This is most likely a problem with the swapi-graphql package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! sh scripts/download
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs swapi-graphql
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!
npm ERR! npm owner ls swapi-graphql
npm ERR! There is likely additional logging output above.npm ERR! Please include the following file with any support request:
npm ERR! /Users/lizborchardt/swapi-graphql/npm-debug.log
Currently the grey color of the url is washed out and should be a brighter color like white
Seeing this in the graphql-js repo under tests, but not here. Am I missing where the enums are defined, or are the tests doubling as the schema definition somehow?
https://github.com/graphql/graphql-js/blob/master/src/__tests__/starWarsSchema.js#L77
After running npm i, we are encountering an error in the build:lambda command, and the error message states that "NODE_ENV" is not recognized as an internal or external command.
Tell the author that this fails on your system:
npm ERR! if [ ! -f src/api/cachedData/cache.js ]; then echo 'Downloading cache...' && node src/api/cachedData/downloadCache.js > src/api/cachedData/cache.js && echo 'Cached!'; fi;
This is the error I am getting on my command prompt while starting the server, Kindly provide your help to resolve the issue.
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.