Skip to content

[http-client-csharp] Change the way of caching models #7758

Open
@ArcturusZhang

Description

@ArcturusZhang
Member

Currently our emitter is caching models and enums by their names.
This is incorrect - because they might have different namespaces. In typespec, you could define models with the same name in different namespaces.
Our current emitter behavior is that if this case happens, these two models will be collapsed to one model with that name - all the places that referenced to either of these models will be changed to the collapsed model.
In most cases, this is wrong and we should fix it.

This has an impact in autorest.csharp because for azure libraries, every model is generated into one big namespace, if we have types with the same name, they will be generated into multiple classes with the same name which cannot compile at all.
But there is always a workaround or solution for that.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    emitter:client:csharpIssue for the C# client emitter: @typespec/http-client-csharp

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Participants

      @ArcturusZhang@jorgerangel-msft

      Issue actions

        [http-client-csharp] Change the way of caching models · Issue #7758 · microsoft/typespec