graphql-rust / graphql-client

Typed, correct GraphQL requests and responses in Rust
Apache License 2.0
1.12k stars 152 forks source link

Generating all types #453

Closed banool closed 11 months ago

banool commented 11 months ago

Using graphql-codgen in Typescript I'm able to generate code from a schema without providing any queries or mutations.

For example:

import type { CodegenConfig } from "@graphql-codegen/cli";

const config: CodegenConfig = {
  overwrite: true,
  schema: "src/canvas/generated/schema.graphql",
  generates: {
    "src/canvas/generated/types.ts": {
      config: {
        emitLegacyCommonJSImports: false,
        namingConvention: "keep",
        avoidOptionals: true,
      },
      plugins: ["typescript"],
    },
  },
};

export default config;

This generates a file called types.rs that has just types, no queries or operations or mutations or anything.

Is there a way to do this with this library? It seems like there isn't via the CLI but I wonder if this is possible with the underlying libraries.

Thanks!

banool commented 11 months ago

I realise this is a duplicate of https://github.com/graphql-rust/graphql-client/issues/443, closing.