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

Generate client in build process from another project/reference #7042

Open
danbopes opened this issue Apr 8, 2024 · 1 comment
Open

Generate client in build process from another project/reference #7042

danbopes opened this issue Apr 8, 2024 · 1 comment
Labels
❓ question This issue is a question about feature of Hot Chocolate. 🌶️ strawberry shake

Comments

@danbopes
Copy link

danbopes commented Apr 8, 2024

Product

Strawberry Shake

Is your feature request related to a problem?

Currently, I can generate a C# client using gRPC by following this approach:

<ItemGroup>
  <Protobuf Include="..\Services.WeatherForecast\Services.WeatherForecast.proto" GrpcServices="Client">
    <Link>Protos\Services.WeatherForecast.proto</Link>
  </Protobuf>
</ItemGroup>

This generates a client that I can use in my app. Whenever I update the protobuf reference in my main app, the resulting client is automatically updated.

The solution you'd like

I’d like to achieve something similar with GraphQL. Imagine if we could do this:

<ItemGroup>
  <Graphql Include="..\Services.WeatherForecast\Services.WeatherForecast.graphql" GraphqlServices="Client">
    <Link>Protos\Services.WeatherForecast.graphql</Link>
  </Protobuf>
</ItemGroup>

This would generate the GraphQL client, which I could then seamlessly use in my app. Given that .NET is increasingly moving toward cloud support and distributed applications (thanks to .NET Aspire), I believe this addition would be incredibly useful and beneficial.

@danbopes danbopes added the 🎉 enhancement New feature or request label Apr 8, 2024
@michaelstaib
Copy link
Member

michaelstaib commented Apr 8, 2024

There are key difference here between GraphQL and gRPC ... if you generate a client for the whole schema you are not going for a cloud first API but something where you need expressions. Strawberry Shake generates from the GraphQL operation as other popular GraphQL clients do.

@michaelstaib michaelstaib added ❓ question This issue is a question about feature of Hot Chocolate. 🌶️ strawberry shake and removed 🎉 enhancement New feature or request labels Apr 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
❓ question This issue is a question about feature of Hot Chocolate. 🌶️ strawberry shake
Projects
None yet
Development

No branches or pull requests

2 participants