Skip to content

Commit

Permalink
feat(http-client-csharp): adopt tcgc getAllModels()
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
  • Loading branch information
Mingzhe Huang (from Dev Box) committed May 11, 2024
1 parent f263c4d commit 5463e8b
Show file tree
Hide file tree
Showing 13 changed files with 624 additions and 337 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 5463e8b

Please sign in to comment.