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

Check the usage of readonly property type in RoundTrip model for DPG #4820

Closed
live1206 opened this issue Jun 12, 2024 · 6 comments · Fixed by microsoft/typespec#3842
Closed
Assignees
Labels
DPG/RLC v2.1 Post Gallium work DPG v3 Version 3 of AutoRest C# generator.

Comments

@live1206
Copy link
Member

TSP:

  model ResultModel {
    name: string;
  }

  model RoundTripModel {
    @visibility("read")
    result: ResultModel;
  }

  @route("/modelInReadOnlyProperty")
  @put
  op modelInReadOnlyProperty(@body body: RoundTripModel): {
    @body body: RoundTripModel;
  };

detailed case can be found in this pr: Azure/cadl-ranch#587

In this case, usage for ResultModel should be Output instead of RoundTrip, because this model is readonly.

@live1206 live1206 added v3 Version 3 of AutoRest C# generator. DPG labels Jun 12, 2024
@live1206 live1206 changed the title Check the usage of readonly property type in RoundTrip model Check the usage of readonly property type in RoundTrip model for DPG Jun 12, 2024
@ArcturusZhang
Copy link
Member

In current DPG's implementation, ResultModel is generated as a RoundTrip model. Therefore we need a fix

@ArcturusZhang
Copy link
Member

Also in today's offline sync up, we kind of have an agreement on the patch convenience methods, therefore we have a way to use the usage from TCGC directly therefore we could expect a final fix for this.

@lirenhe lirenhe added the DPG/RLC v2.1 Post Gallium work label Jun 13, 2024
@ArcturusZhang
Copy link
Member

ArcturusZhang commented Jun 21, 2024

This should have fixed this issue despite we did not know quite well which part introduces the fix.
But from the result's perspective, this is fixed.

@live1206
Copy link
Member Author

This should have fixed this issue despite we did not know quite well which part introduces the fix. But from the result's perspective, this is fixed.

Are you saying csharp emitter has not consumed TCGC usage yet, but the usage still got fixed?

@ArcturusZhang
Copy link
Member

This should have fixed this issue despite we did not know quite well which part introduces the fix. But from the result's perspective, this is fixed.

Are you saying csharp emitter has not consumed TCGC usage yet, but the usage still got fixed?

that statement is not fully correct. We converted the usage value from TCGC to ours (like this) - therefore when tcgc has the fix, we get the changes in DPG as well.

@live1206
Copy link
Member Author

This should have fixed this issue despite we did not know quite well which part introduces the fix. But from the result's perspective, this is fixed.

Are you saying csharp emitter has not consumed TCGC usage yet, but the usage still got fixed?

that statement is not fully correct. We converted the usage value from TCGC to ours (like this) - therefore when tcgc has the fix, we get the changes in DPG as well.

OK. Then we know the fix is from TCGC.

github-merge-queue bot pushed a commit to microsoft/typespec that referenced this issue Jul 25, 2024
Fixes Azure/autorest.csharp#4820
Fixes Azure/autorest.csharp#4734

This PR changes our the converter logic in our emitter, so that we do
not need to convert the usage flags from TCGC to ours, we directly use
their result. As part of the motivation, a few workaround logic to "fix"
the usages has been removed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
DPG/RLC v2.1 Post Gallium work DPG v3 Version 3 of AutoRest C# generator.
Projects
None yet
4 participants