Skip to content

HandleBars Input Type field default value - not found #2

Open
@JohnnyMaxK

Description

@JohnnyMaxK

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:

            {
                "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:

  • hasDefaultValue
  • defaultValue

Environment:

  • OS: Windows
  • Codegen: gql-gen
  • Node: v10.15.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions