Skip to content

Commit

Permalink
feat(http-client-csharp): adopt tcgc getAllModels() (#3326)
Browse files Browse the repository at this point in the history
- upgrade TCGC to `0.41.8`
- replace old emitter codes which deal with primitive compiler-provided
types with new codes which handles TCGC SDK types
- update test cases
- fix some issues round during migration

This is a backport of Azure/autorest.csharp#4185

---------

Co-authored-by: Mingzhe Huang (from Dev Box) <[email protected]>
Co-authored-by: Arcturus Zhang <[email protected]>
  • Loading branch information
3 people authored May 11, 2024
1 parent f263c4d commit 5ad463b
Show file tree
Hide file tree
Showing 15 changed files with 628 additions and 342 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
SdkClient,
SdkContext,
SdkOperationGroup,
getAllModels,
getLibraryName,
listClients,
listOperationGroups,
Expand Down Expand Up @@ -49,6 +50,9 @@ import { resolveServers } from "./typespec-server.js";
import { createContentTypeOrAcceptParameter } from "./utils.js";

export function createModel(sdkContext: SdkContext<NetEmitterOptions>): CodeModel {
// initialize tcgc model
if (!sdkContext.operationModelsMap) getAllModels(sdkContext);

const services = listServices(sdkContext.emitContext.program);
if (services.length === 0) {
services.push({
Expand Down Expand Up @@ -155,7 +159,7 @@ export function createModelForService(
}
}

navigateModels(sdkContext, serviceNamespaceType, modelMap, enumMap);
navigateModels(sdkContext, modelMap, enumMap);

const usages = getUsages(sdkContext, convenienceOperations, modelMap);
setUsage(usages, modelMap);
Expand Down
Loading

0 comments on commit 5ad463b

Please sign in to comment.