Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Port of graphql-relay-js #3

Closed
TimothyKrell opened this issue Aug 20, 2015 · 15 comments
Closed

Port of graphql-relay-js #3

TimothyKrell opened this issue Aug 20, 2015 · 15 comments

Comments

@TimothyKrell
Copy link

Are you planning on integrating any of the graphql relay helpers into this library? https://github.com/graphql/graphql-relay-js

@vladar
Copy link
Member

vladar commented Aug 20, 2015

I'd be happy to do so, but realisticly - can't provide any timeframes on when this will be done. Contributions are welcome if you get there before me!

Separate repo is another option.

@TimothyKrell
Copy link
Author

Thanks for the reply! I'll definitely do a pull request if I get there first, but I'm much more of a novice at PHP. Thanks for this library! I'm currently testing using it with out Laravel backend.

@arec
Copy link

arec commented Sep 10, 2015

I've already done this with a bit help from graphql-lavarel. Here are few things missing that I've done:

  1. [MOST IMPORTANT] a function to export a schema.json file for RelayJS. I'm currently using a really BIG QUERY to generate it.
  2. NodeInterface
  3. tool to generate connectionTypes and mutationTypes

@vladar
Copy link
Member

vladar commented Sep 10, 2015

@arec about RelayJS schema - use query from GraphQL\Type\Introspection::getIntrospectionQuery() to generate schema.json. It's a regular introspection feature of GraphQL.

I currently do it via custom node-js script that uses same introspection query from graphql-js, in case if someone is interested:

#!/usr/bin/env babel-node --optional es7.asyncFunctions

import fs from 'fs';
import path from 'path';
import { introspectionQuery } from 'graphql/utilities';
import rp from 'request-promise';

var options = {
    uri: 'path-to-your-graphql-endpoint',
    method: 'POST',
    form: {
        query: introspectionQuery
    }
};

console.log('Requesting schema from', options.uri);

rp(options)
    .then((result) => {
        var fname = path.join(__dirname, '/schema.json');
        console.log('Successfully retrieved schema (' + (result||'').length + ') . Writing to ' + fname);

        fs.writeFileSync(
            fname,
            result
          // JSON.stringify(result, null, 2)
        );
    })
    .catch((result) => {
        console.error(result);
    });

Wanted this to be integrated with JS workflow, hence JS version vs PHP.

@arec
Copy link

arec commented Sep 10, 2015

Great thanks. Never notice that REALLY BIG QUERY is right there!

@TimothyKrell
Copy link
Author

@arec, could you post a gist or something with your code for the NodeInterface, connectionTypes, and mutationTypes so I could see how you are doing it?

@beeb
Copy link

beeb commented Oct 13, 2015

@arec +1, I'd really like to see what you've done!

@Gugudesaster
Copy link

Does anyone have a solution or workaround here? I would really like to play around with graphql and relay, but can't seem to get it working with the current package.

@vladar
Copy link
Member

vladar commented Nov 12, 2015

@Gugudesaster Tools in https://github.com/graphql/graphql-relay-js are simple helpers around GraphQL system.

They do not provide special structures or algorithms - they just slightly simplify creating GraphQL types specific for Relay. You should be able to create such types even without those helpers.

Can you share what exactly blocks you?

@vladar
Copy link
Member

vladar commented Nov 12, 2015

Also check out Relay specs for GQL types: https://facebook.github.io/relay/docs/graphql-relay-specification.html#content

@ivome
Copy link
Contributor

ivome commented Feb 23, 2016

FYI: I'm currently working on an exact port of https://github.com/graphql/graphql-relay-js to PHP based on this repository here. Should be there soon...

@vladar
Copy link
Member

vladar commented Feb 23, 2016

@ivome That's great! When you're done - post the link here to your repo and I'll add it to Readme.

@TimothyKrell
Copy link
Author

@ivome Nice! Can't wait to see what you come up with.

@vladar Thanks for this awesome library. Currently I've been using these Laravel specific packages based off of your port:

You might want to add those to the Readme as well.

@ivome
Copy link
Contributor

ivome commented Feb 23, 2016

I'm not done yet, but I just published the repo: https://github.com/ivome/graphql-relay-php

The basic helper functions are all in place along with their tests. There are still a few things left to be done. Especially documentation is lacking. If someone wants to help, check out the issues: https://github.com/ivome/graphql-relay-php/issues

@vladar
Copy link
Member

vladar commented Feb 24, 2016

Nice! Will throw away my current hackish helpers and use your repo instead.

Added section to Readme on Complementary tools. Guess I can finally close this issue %)

@vladar vladar closed this as completed Feb 24, 2016
yura3d added a commit to yura3d/graphql-php that referenced this issue Jul 15, 2019
vladar pushed a commit that referenced this issue Oct 13, 2019
* Added inline fragments support to ResolveInfo

* Revert "Added inline fragments support to ResolveInfo"

This reverts commit c35379c.

* Inline fragments and union type support for QueryPlan

* Introduced $options to prevent BC

* No more underscores for fragments data

* Fixed Scrutinizer

* Fixed Scrutinizer #2

* Fixed Scrutinizer #3

* Renamings; merging fields inside fragments

* Fixed fields order for merged types

* Grouping implementor fields for abstract types
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants