ChilliCream / ChilliCream/graphql-platform

Strawberry Shake Razor Components use RuntimeType instead of InterfaceType for Operation

Open
#9,635 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

🌶️ strawberry shake
Dominant language
C#
Stars
5.8k
Forks
810
Avg merge
15h 39m
Merged PRs (30d)
98

Description

Product

Strawberry Shake

Version

15.0.0

Link to minimal reproduction

https://github.com/ChilliCream/graphql-platform/blob/main/src/StrawberryShake/CodeGeneration/test/CodeGeneration.Razor.Tests/__snapshots__/RazorGeneratorTests.Query_And_Mutation.snap#L1320

Steps to reproduce

Use Strawberry Shake to generate blazor query components

What is expected?

Operation Interface type used

What is actually happening?

Sample taken from the razor generation tests

    public partial class UseGetBars : global::StrawberryShake.Razor.UseQuery<global::Foo.Bar.IGetBarsResult>
    {
        [global::Microsoft.AspNetCore.Components.InjectAttribute]
        internal global::Foo.Bar.GetBarsQuery Operation { get; set; } = default !;

         ....
    }

GetBarsQuery is used instead of IGetBarsQuery

This typically poses no issue until you try to mock the component for unit tests (Bunit)

Relevant log output

Additional context

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Strawberry Shake Razor generation tests and the linked snapshot at src/StrawberryShake/CodeGeneration/test/CodeGeneration.Razor.Tests/snapshots/RazorGeneratorTests.Query_And_Mutation.snap#L1320. Trace how the generated component's Operation type is selected, then update the generation so it uses IGetBarsQuery and verify the Razor generation tests reflect the interface type.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.