Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gRPC handler: load defaults option not working #5277

Closed
1 of 4 tasks
igor-ag5 opened this issue Apr 2, 2023 · 1 comment · Fixed by igor-ag5/graphql-mesh#1 or #5278
Closed
1 of 4 tasks

gRPC handler: load defaults option not working #5277

igor-ag5 opened this issue Apr 2, 2023 · 1 comment · Fixed by igor-ag5/graphql-mesh#1 or #5278

Comments

@igor-ag5
Copy link
Contributor

igor-ag5 commented Apr 2, 2023

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

@igor-ag5
Copy link
Contributor Author

igor-ag5 commented Apr 2, 2023

Accidentally closed by my fork, however, it should be still open.

@igor-ag5 igor-ag5 reopened this Apr 2, 2023
This was referenced Apr 30, 2024
This was referenced May 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant