AEB-labs / cruddl

Create a GraphQL API for your database, using the GraphQL SDL to model your schema.
https://aeb-labs.github.io/cruddl/
MIT License
131 stars 17 forks source link

Apollo Federation and ArangoSearch #101

Open itsezc opened 4 years ago

itsezc commented 4 years ago

Is Cruddl compatible with Apollo Federation? if so are there any working examples of it?

And also, is there any plans to support ArangoSearch in the future?

Yogu commented 4 years ago

I don't think there is anything preventing you from embedding a cruddl-generated schema into Apollo Federation, but it might be a little tricky to incorporate all the features. I haven't used it myself, but as far as I understand, it needs a SDL of all federated schemas that can include some directives defined by Apollo. If you don't need any special directives in the cruddl schema, this should not be a problem. However, if you want to add directives, you would need to add them programatically to a SDL generated from the cruddl-generated schema.

And also, is there any plans to support ArangoSearch in the future?

Yes, and it's already implemented, but not released yet. If you want to test it, you can use cruddl@1.1.0-alpha.0.

robross0606 commented 4 years ago

Apollo Federation has a known bug with directives which might prevent this without a workaround.

Yogu commented 4 years ago

My suggestion would be to use printSchema on the cruddl-generated schema which does not have any directives, so custom cruddl directives shouldn't be a problem.

robross0606 commented 4 years ago

The suggested workaround using mergeSchema() does also appear to work if needed for some reason. I've tested it with (non-cruddl) custom directives on our federation.

itsezc commented 4 years ago

The suggested workaround using mergeSchema() does also appear to work if needed for some reason. I've tested it with (non-cruddl) custom directives on our federation.

Yup, tried it with printSchema works like a charm (:

Will be playing around with Foxx and Cruddl together and see how well they go together

Also OFT: I've submitted Cruddl to https://stackshare.io would be nice to have a logo as its an opportunity to increase awareness.

orefalo commented 4 years ago

Looks like we are trying to do the same thing. DevOps setup - each domain maintained by a team, arango+cruddl for fast/simple code generation. federation at the top.

orefalo commented 4 years ago

I've been researching the topic over the last few days.

Official Spec

Spec: https://www.apollographql.com/docs/apollo-server/federation/federation-spec/

Postgraphile implementation of federation

Thread: https://github.com/graphile/postgraphile/issues/1094 Project: https://github.com/graphile/federation

Interesting

Finally, I found this really interesting project: https://github.com/0xR/graphql-transform-federation test project: https://github.com/0xR/graphql-transform-federation-blog

dijbi commented 4 years ago

@itsezc :

Yup, tried it with printSchema works like a charm (:

I can not figure out how to use printSchema for that matter ... could you explain ?

Thnks

itsezc commented 4 years ago

@itsezc :

Yup, tried it with printSchema works like a charm (:

I can not figure out how to use printSchema for that matter ... could you explain ?

  • The output of printSchema being a string in Schema Langage, how to add dynamically the @keys(fields),extend type.....
  • or do you save it in a separate field then change it to be Apollo Federation compatible ?

Thnks

The latter, however it's pretty hacky but need not worry we just have to wait for https://github.com/apollographql/apollo-server/pull/3013 to be resolved