netspective / graphql-codegen-csharp

Experimental GraphQL code generator template for C# projects
https://github.com/dotansimha/graphql-code-generator
10 stars 11 forks source link

HandleBars Input Type field default value - not found #2

Open Johnny-Bee opened 5 years ago

Johnny-Bee commented 5 years ago

Describe the bug I'm not sure if graphql-coden-csharp is in cause but I cannot see the default value of input type field when I'm using HandleBars. When I show the content of the input node from the handle bars point of view I have this:

{ name: 'OrderByInput',
  description: '',
  fields:
   [ { name: 'by',
       description: 'The column you want to make the order by',
       arguments: [],
       type: 'MerchantOrderBy',
       raw: 'MerchantOrderBy!',
       isNullableArray: false,
       isArray: false,
       isRequired: true,
       hasArguments: false,
       isEnum: true,
       isScalar: false,
       isInterface: false,
       isUnion: false,
       isInputType: false,
       isType: false,
       directives: {},
       usesDirectives: false },
     { name: 'direction',
       description: '',
       arguments: [],
       type: 'Direction',
       raw: 'Direction!',
       isNullableArray: false,
       isArray: false,
       isRequired: true,
       hasArguments: false,
       isEnum: true,
       isScalar: false,
       isInterface: false,
       isUnion: false,
       isInputType: false,
       isType: false,
       directives: {},
       usesDirectives: false } ],
  interfaces: [],
  isInputType: true,
  hasFields: true,
  hasInterfaces: false,
  directives: {},
  usesDirectives: false }

To Reproduce Steps to reproduce the behavior:

  1. Use '...' as schema
    
    # The best query of the world
    type Query
    {
    merchants(input:OrderByInput):[Merchant]
    }

schema{ query: Query }

type Merchant { code: String! }

enum Direction{ ASCENDING, DESCENDING, }

enum MerchantOrderBy { CREATION, MODIFICATION }

input OrderByInput {

The column you want to make the order by

by: MerchantOrderBy! = CREATION
direction: Direction! = DESCENDING

}


I can transform without any lost into an Introspection schema using the graphql-code-generator:

``` json
            {
                "kind": "INPUT_OBJECT",
                "name": "OrderByInput",
                "description": "",
                "fields": null,
                "inputFields": [
                    {
                        "name": "by",
                        "description": "The column you want to make the order by",
                        "type": {
                            "kind": "NON_NULL",
                            "name": null,
                            "ofType": {
                                "kind": "ENUM",
                                "name": "MerchantOrderBy",
                                "ofType": null
                            }
                        },
                        "defaultValue": "CREATION"
                    },
                    {
                        "name": "direction",
                        "description": "",
                        "type": {
                            "kind": "NON_NULL",
                            "name": null,
                            "ofType": {
                                "kind": "ENUM",
                                "name": "Direction",
                                "ofType": null
                            }
                        },
                        "defaultValue": "DESCENDING"
                    }
                ],
                "interfaces": null,
                "enumValues": null,
                "possibleTypes": null
            },
  1. Run the following command: gql-gen ...

gql-gen --schema "schema.graphql.json" --template graphql-codegen-csharp --out "schema.generated.cs"

Expected behavior I expect to see the properties in the input field:

Environment:

Johnny-Bee commented 3 years ago

Up ?