Very early v8 feedback #1152
Replies: 3 comments 5 replies
-
Hey @aaronadamsCA thanks for the feedback! I really appreciate it. I'll take up your issues one by one.
Ideally this should be really easy. Was/is https://graffle.js.org/guides/misc/output helpful for you? I've noted in #1024 to have add a migration guide.
This should also just work but I understand why it is not. I am aware of dotansimha/graphql-typed-document-node#68. Graffle is using https://graphql-js.org/api/interface/TypedQueryDocumentNode which is newer and in theory more community friendly because of its community core position. Hey @dotansimha could you weigh in on this, since that issue I referenced is multiple years old now. Are there plans to modernize around newer versions of
Can you share more about this one? Graffle doesn't use that library 🤔.
I'm actively working on simplifying whilst also making more powerful the customer scalar story for Graffle. Stay tuned, hopefully will wrap up all the changes by end of next week including new docs and test coverage. The issues are a bit messy for this but related are: #1150, #1149.
There's lots to say here.
I'm not sure I follow your own thoughts about mocking in your setup, happy to hear more. |
Beta Was this translation helpful? Give feedback.
-
@aaronadamsCA thanks for reporting that json-big-int issue, it must have crept in via auto import some time and because it was |
Beta Was this translation helpful? Give feedback.
-
Today we have multiple web apps in a monorepo, with each graph client in its own package. I'd like to try to maintain this separation of responsibilities if possible. If we can encapsulate generation and mocking in our graph client packages, then our apps don't need to know those implementation details. Let me know if you see any problems with this approach:
For Step 2, it would probably be easiest if the Graffle CLI saved the result of the introspection query to a JSON file, so we could just import it to create our mock schema: import { addMocksToSchema } from "@graphql-tools/mock";
import { Graffle } from "graffle";
import { buildClientSchema } from "graphql";
import introspectionResult from "./graffle/schema.json";
const schema = buildClientSchema(introspectionResult);
const schemaWithMocks = addMocksToSchema({
schema,
mocks: {},
});
export const client = Graffle.create({ schema: schemaWithMocks }); Otherwise this approach seems to work! I already created a little POC to confirm the clients can be used interchangeably, and everything seems to work so far. |
Beta Was this translation helpful? Give feedback.
-
Hey @jasonkuhrt, I've started to explore Graffle and I have feedback and questions.
It's an exciting project because I'm pretty sure Graffle could eventually replace a boatload of tooling in our repo, including
graphql-codegen
,graphql-config
,@graphql-eslint/eslint-plugin
, and possibly evenmsw
.I think migration would go something like this:
graphql-request
forgraffle
using a static client and typed document nodes.I tried playing around with the library today and ran into a few early trouble spots:
createClient(): GraphQLClient
signature.client.raw({ document })
doesn't seem to be compatible withTypedDocumentNode
from@graphql-typed-document-node/core
, so I can't use existing documents generated bygraphql-codegen
.json-bigint
(adding the dependency works around the issue).Global.ts
maps custom scalars toStandardScalar.String
, but the scalar imports are wrong so the module breaks.I'm also curious about mocking responses. We currently share typed document nodes between
graphql-request
andmsw
, which can be painful; every operation change requires regenerating documents and updating mock responses, plus it's hard to get MSW working at all in certain environments.Since a Graffle generated client knows nothing about operations, I'm guessing the approach here would instead involve mocking an in-memory schema? If so, it would be great if we could use the generated HTTP client to help create the mock, so we could get type safety and skip all the
GraphQLSchema
boilerplate.Beta Was this translation helpful? Give feedback.
All reactions