Skip to content

gRPC handler: load defaults option not working #5277

@igor-ag5

Description

@igor-ag5

Issue workflow progress

Progress of the issue based on the
Contributor Workflow

  • 1. The issue provides a reproduction available on
    Github

  • 2. A failing test has been provided

  • 3. A local solution has been provided

  • 4. A pull request is pending review


Describe the bug
Setting the load defaults option for a grpc handler:

    - name: DemoService
      handler:
        grpc:
          endpoint: localhost:9003
          source:
            load:
              defaults: true
            file: ../service_go/service_proto/demo_service.proto

does not result in the expected behavior where the default values are provided instead of setting the fields to null.

To Reproduce Steps to reproduce the behavior:
The issue can be reproduced by following steps in this repo.

Expected behavior
When the defaults: true option is set in the config then the fields with default values should be set instead of being null. E.g.:
expected response (where ENUM_ZERO is the default value)

{
  "data": {
    "DemoService_GetSomeData": {
      "data": [
        {
          "someTextData": "data 0",
          "someEnum": "ENUM_ZERO"
        },
        {
          "someTextData": "data 1",
          "someEnum": "ENUM_ONE"
        }
      ]
    }
  }
}

Actual response:

{
  "data": {
    "DemoService_GetSomeData": {
      "data": [
        {
          "someTextData": "data 0",
          "someEnum": null
        },
        {
          "someTextData": "data 1",
          "someEnum": "ENUM_ONE"
        }
      ]
    }
  }
}

Environment:

  • OS: macOS Ventura 13.2.1
  • Package versions
"@graphql-mesh/cli": "^0.82.23",
"@graphql-mesh/graphql": "^0.34.6",
"@graphql-mesh/grpc": "^0.29.16"
  • NodeJS: v18.14.1

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions