Skip to content

wgc grpc-service generate rejects arguments on a nested field #3114

Description

@willglynn

Component(s)

composition

Component version

0.63.1

wgc version

0.129.3

controlplane version

n/a

router version

0.334.0

What happened?

I pushed a failing test at 54cbe6e.

Description

wgc grpc-service generate rejects arguments on a nested field.

Steps to Reproduce

Define a schema:

type Query {
  weather: Weather!
}

# A singleton, intentionally lacking an id: ID! field.
type Weather {
  current: Conditions!
  hourlyForecast(hours: Int): [Conditions!]!
}

type Conditions {
  temperatureC: Float!
}

Define an operation operations/weather-card.graphql:

query WeatherCard($hours: Int) {
  weather {
    hourlyForecast(hours: $hours) {
      temperatureC
    }
  }
}

Attempt to generate a gRPC service for this operation.

% wgc grpc-service generate testservice -i schema.graphql -o ./out -w ./operations

Expected Result

Success.

service Testservice {
  rpc WeatherCard(WeatherCardRequest) returns (WeatherCardResponse) {
    option idempotency_level = NO_SIDE_EFFECTS;
  }
}

message WeatherCardRequest {
  google.protobuf.Int32Value hours = 1;
}

message WeatherCardResponse {
  message Weather {
    message HourlyForecast {
      double temperature_c = 1;
    }
    repeated HourlyForecast hourly_forecast = 1;
  }
  Weather weather = 1;
}

Adding id: ID! to Weather causes this outcome. The presence or absence of that field should change nothing about the generated output. Adding an ID causes this to work, even though that shouldn't be involved.

Actual Result

Failure.

[!] Schema validation warnings:
 ├─ warn: No @connect__fieldResolver directive found on the field hourlyForecast - falling back to ID field at line 8, column 3

[✕] Schema validation errors:
 └─ error: Invalid context provided for resolver. No fields with type ID found at line 8, column 3

Schema validation failed with 1 error(s)

Environment information

No response

Router configuration

Router execution config

Log output

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions