@mac
There are several ways to generate C# types from a GraphQL schema. One popular tool for accomplishing this task is the GraphQL Code Generator.
Here is how you can generate C# types from a GraphQL schema using the GraphQL Code Generator:
1
|
npm install @graphql-codegen/cli @graphql-codegen/typescript @graphql-codegen/typescript-operations @graphql-codegen/typescript-react-apollo --save-dev |
1 2 3 4 5 6 7 8 |
schema: http://localhost:4000/graphql
documents: null
generates:
./src/types.ts:
plugins:
- typescript
- typescript-operations
- typescript-react-apollo
|
1
|
npx graphql-codegen |
The generated C# types will be saved in the types.ts file located in the src directory of your project.
Alternatively, you can also use tools like GraphQL Genie or GraphQL to C# types to generate C# types from a GraphQL schema.