Skip to content

alan-francis/graphql-codegen-csharp

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation



CSharp template

Experimental GraphQL code generator template for C# projects using instructions provided at this site.

This template reads the introspection JSON of a GraphQL schema as an input. The user has to also mention the output folder where the file has to be written

The name of the output file can be defined in src/config.ts

Usage

For executing the template, install graphql-code-generator first. See the install instructions here.

Once we install graphql-code-generator, clone this project into your workspace.

After cloning the project, we can either install or build the template to function the graphql code generator.

Install the template using npm install command from the project folder path.

npm install -g

After installing the template, run the following command to generate the c# code from the graphql schema.

gql-gen --schema "graphQL schema JSON path" --template "graphql-codegen-csharp" --out "output folder path"

You can either build the template using yarn build command and run the following command to run the generator.

gql-gen --schema "graphQL schema JSON" --template "path of the template file" --out "output folder path"

Other Cli Flag options are listed here.

Once the C# code got generated, add the file into class library project in Visual Studio.

Build the project and check if any type errors are there.

About

Experimental GraphQL code generator template for C# projects

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • HTML 69.1%
  • TypeScript 30.9%