@azure-tools/typespec-java 0.21.0 → 0.21.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -19,14 +19,14 @@ import { SchemaContext } from "./common/schemas/usage.js";
19
19
  import { createPollOperationDetailsSchema, getFileDetailsSchema } from "./external-schemas.js";
20
20
  import { ClientContext } from "./models.js";
21
21
  import { CONTENT_TYPE_KEY, ORIGIN_API_VERSION, SPECIAL_HEADER_NAMES, cloneOperationParameter, getServiceVersion, isKnownContentType, isLroNewPollingStrategy, isPayloadProperty, operationIsJsonMergePatch, operationIsMultipart, operationIsMultipleContentTypes, } from "./operation-utils.js";
22
- import { ProcessingCache, getAccess, getDurationFormatFromSdkType, getNonNullSdkType, getUnionDescription, getUsage, isStable, modelIs, pushDistinct, } from "./type-utils.js";
22
+ import { ProcessingCache, getAccess, getDurationFormat, getNonNullSdkType, getUnionDescription, getUsage, isStable, modelIs, pushDistinct, } from "./type-utils.js";
23
23
  import { getNamespace, logWarning, pascalCase, removeClientSuffix, stringArrayContainsIgnoreCase, trace, } from "./utils.js";
24
24
  const { isEqual } = pkg;
25
25
  export class CodeModelBuilder {
26
26
  constructor(program1, context) {
27
27
  var _a, _b;
28
28
  this.loggingEnabled = false;
29
- this.schemaCache = new ProcessingCache((type, name) => this.processSchemaFromSdkTypeImpl(type, name));
29
+ this.schemaCache = new ProcessingCache((type, name) => this.processSchemaImpl(type, name));
30
30
  this.typeUnionRefCache = new Map(); // Union means it ref a Union type, null means it does not ref any Union, undefined means type visited but not completed
31
31
  this.options = context.options;
32
32
  this.program = program1;
@@ -103,11 +103,11 @@ export class CodeModelBuilder {
103
103
  parameter = this.createApiVersionParameter(arg.name, ParameterLocation.Uri);
104
104
  }
105
105
  else {
106
- const schema = this.processSchemaFromSdkType(arg.type, arg.name);
106
+ const schema = this.processSchema(arg.type, arg.name);
107
107
  this.trackSchemaUsage(schema, {
108
108
  usage: [SchemaContext.Input, SchemaContext.Output /*SchemaContext.Public*/],
109
109
  });
110
- parameter = new Parameter(arg.name, (_a = arg.description) !== null && _a !== void 0 ? _a : "", schema, {
110
+ parameter = new Parameter(arg.name, (_a = arg.doc) !== null && _a !== void 0 ? _a : "", schema, {
111
111
  implementation: ImplementationLocation.Client,
112
112
  origin: "modelerfour:synthesized/host",
113
113
  required: true,
@@ -160,7 +160,7 @@ export class CodeModelBuilder {
160
160
  schemeOrApiKeyPrefix = pascalCase(schemeOrApiKeyPrefix);
161
161
  if (this.isBranded()) {
162
162
  // Azure would not allow BasicAuth or BearerAuth
163
- this.logWarning(`{scheme.scheme} auth method is currently not supported.`);
163
+ this.logWarning(`${scheme.scheme} auth method is currently not supported.`);
164
164
  continue;
165
165
  }
166
166
  }
@@ -196,20 +196,20 @@ export class CodeModelBuilder {
196
196
  if (!processedSdkModels.has(model)) {
197
197
  const access = getAccess(model.__raw, accessCache);
198
198
  if (access === "public") {
199
- const schema = this.processSchemaFromSdkType(model, "");
199
+ const schema = this.processSchema(model, "");
200
200
  this.trackSchemaUsage(schema, {
201
201
  usage: [SchemaContext.Public],
202
202
  });
203
203
  }
204
204
  else if (access === "internal") {
205
- const schema = this.processSchemaFromSdkType(model, model.name);
205
+ const schema = this.processSchema(model, model.name);
206
206
  this.trackSchemaUsage(schema, {
207
207
  usage: [SchemaContext.Internal],
208
208
  });
209
209
  }
210
210
  const usage = getUsage(model.__raw, usageCache);
211
211
  if (usage) {
212
- const schema = this.processSchemaFromSdkType(model, "");
212
+ const schema = this.processSchema(model, "");
213
213
  this.trackSchemaUsage(schema, {
214
214
  usage: usage,
215
215
  });
@@ -299,8 +299,8 @@ export class CodeModelBuilder {
299
299
  const clientSubNamespace = clientNameSegments.slice(0, -1).join(".");
300
300
  javaNamespace = this.getJavaNamespace(this.namespace + "." + clientSubNamespace);
301
301
  }
302
- const codeModelClient = new CodeModelClient(clientName, (_b = client.details) !== null && _b !== void 0 ? _b : "", {
303
- summary: client.description,
302
+ const codeModelClient = new CodeModelClient(clientName, (_b = client.doc) !== null && _b !== void 0 ? _b : "", {
303
+ summary: client.summary,
304
304
  language: {
305
305
  default: {
306
306
  namespace: this.namespace,
@@ -339,16 +339,16 @@ export class CodeModelBuilder {
339
339
  if (initializationProperty.kind === "endpoint") {
340
340
  let sdkPathParameters = [];
341
341
  if (initializationProperty.type.kind === "union") {
342
- if (initializationProperty.type.values.length === 2) {
342
+ if (initializationProperty.type.variantTypes.length === 2) {
343
343
  // only get the sdkPathParameters from the endpoint whose serverUrl is not {"endpoint"}
344
- for (const endpointType of initializationProperty.type.values) {
344
+ for (const endpointType of initializationProperty.type.variantTypes) {
345
345
  if (endpointType.kind === "endpoint" && endpointType.serverUrl !== "{endpoint}") {
346
346
  sdkPathParameters = endpointType.templateArguments;
347
347
  baseUri = endpointType.serverUrl;
348
348
  }
349
349
  }
350
350
  }
351
- else if (initializationProperty.type.values.length > 2) {
351
+ else if (initializationProperty.type.variantTypes.length > 2) {
352
352
  throw new Error("Multiple server url defined for one client is not supported yet.");
353
353
  }
354
354
  }
@@ -513,9 +513,9 @@ export class CodeModelBuilder {
513
513
  const operationId = groupName ? `${groupName}_${operationName}` : `${operationName}`;
514
514
  const operationGroup = this.codeModel.getOperationGroup(groupName);
515
515
  const operationExamples = this.getOperationExample(sdkMethod);
516
- const codeModelOperation = new CodeModelOperation(operationName, (_a = sdkMethod.details) !== null && _a !== void 0 ? _a : "", {
516
+ const codeModelOperation = new CodeModelOperation(operationName, (_a = sdkMethod.doc) !== null && _a !== void 0 ? _a : "", {
517
517
  operationId: operationId,
518
- summary: sdkMethod.description,
518
+ summary: sdkMethod.summary,
519
519
  extensions: {
520
520
  "x-ms-examples": operationExamples,
521
521
  },
@@ -603,24 +603,24 @@ export class CodeModelBuilder {
603
603
  lroMetadata = this.processLroMetadata(codeModelOperation, sdkMethod);
604
604
  }
605
605
  // responses
606
- for (const [code, response] of sdkMethod.operation.responses) {
607
- this.processResponse(codeModelOperation, code, response, lroMetadata.longRunning, false);
606
+ for (const response of sdkMethod.operation.responses) {
607
+ this.processResponse(codeModelOperation, response.statusCodes, response, lroMetadata.longRunning, false);
608
608
  }
609
609
  // exception
610
- for (const [code, response] of sdkMethod.operation.exceptions) {
611
- this.processResponse(codeModelOperation, code, response, lroMetadata.longRunning, true);
610
+ for (const response of sdkMethod.operation.exceptions) {
611
+ this.processResponse(codeModelOperation, response.statusCodes, response, lroMetadata.longRunning, true);
612
612
  }
613
613
  // check for paged
614
614
  this.processRouteForPaged(codeModelOperation, sdkMethod.operation.responses, sdkMethod);
615
615
  // check for long-running operation
616
- this.processRouteForLongRunning(codeModelOperation, sdkMethod.operation.responses, lroMetadata);
616
+ this.processRouteForLongRunning(codeModelOperation, lroMetadata);
617
617
  operationGroup.addOperation(codeModelOperation);
618
618
  return codeModelOperation;
619
619
  }
620
620
  processRouteForPaged(op, responses, sdkMethod) {
621
621
  var _a, _b;
622
622
  if (sdkMethod.kind === "paging" || sdkMethod.kind === "lropaging") {
623
- for (const [_, response] of responses) {
623
+ for (const response of responses) {
624
624
  const bodyType = response.type;
625
625
  if (bodyType && bodyType.kind === "model") {
626
626
  const itemName = sdkMethod.response.resultPath;
@@ -671,7 +671,7 @@ export class CodeModelBuilder {
671
671
  else {
672
672
  const pollType = this.findResponseBody(lroMetadata.pollingInfo.responseModel);
673
673
  const sdkType = getClientType(this.sdkContext, pollType);
674
- pollingSchema = this.processSchemaFromSdkType(sdkType, "pollResult");
674
+ pollingSchema = this.processSchema(sdkType, "pollResult");
675
675
  }
676
676
  // finalSchema
677
677
  if (verb !== "delete" &&
@@ -684,7 +684,7 @@ export class CodeModelBuilder {
684
684
  : lroMetadata.finalEnvelopeResult;
685
685
  const finalType = this.findResponseBody(finalResult);
686
686
  const sdkType = getClientType(this.sdkContext, finalType);
687
- finalSchema = this.processSchemaFromSdkType(sdkType, "finalResult");
687
+ finalSchema = this.processSchema(sdkType, "finalResult");
688
688
  if (useNewPollStrategy &&
689
689
  lroMetadata.finalStep &&
690
690
  lroMetadata.finalStep.kind === "pollingSuccessProperty" &&
@@ -715,7 +715,7 @@ export class CodeModelBuilder {
715
715
  }
716
716
  return new LongRunningMetadata(false);
717
717
  }
718
- processRouteForLongRunning(op, responses, lroMetadata) {
718
+ processRouteForLongRunning(op, lroMetadata) {
719
719
  var _a;
720
720
  if (lroMetadata.longRunning) {
721
721
  op.extensions = (_a = op.extensions) !== null && _a !== void 0 ? _a : {};
@@ -759,7 +759,7 @@ export class CodeModelBuilder {
759
759
  else {
760
760
  // schema
761
761
  const sdkType = getNonNullSdkType(param.type);
762
- const schema = this.processSchemaFromSdkType(sdkType, param.name);
762
+ const schema = this.processSchema(sdkType, param.name);
763
763
  let extensions = undefined;
764
764
  if (param.kind === "path") {
765
765
  if (param.allowReserved) {
@@ -833,8 +833,8 @@ export class CodeModelBuilder {
833
833
  param.correspondingMethodParams.length > 0 &&
834
834
  param.correspondingMethodParams[0].onClient;
835
835
  const nullable = param.type.kind === "nullable";
836
- const parameter = new Parameter(param.name, (_b = param.details) !== null && _b !== void 0 ? _b : "", schema, {
837
- summary: param.description,
836
+ const parameter = new Parameter(param.name, (_b = param.doc) !== null && _b !== void 0 ? _b : "", schema, {
837
+ summary: param.summary,
838
838
  implementation: parameterOnClient
839
839
  ? ImplementationLocation.Client
840
840
  : ImplementationLocation.Method,
@@ -978,14 +978,14 @@ export class CodeModelBuilder {
978
978
  let schema;
979
979
  if (unknownRequestBody && sdkType.kind === "bytes") {
980
980
  // if it's unknown request body, handle binary request body
981
- schema = this.processBinarySchemaFromSdkType(sdkType);
981
+ schema = this.processBinarySchema(sdkType);
982
982
  }
983
983
  else {
984
- schema = this.processSchemaFromSdkType(getNonNullSdkType(sdkType), sdkBody.name);
984
+ schema = this.processSchema(getNonNullSdkType(sdkType), sdkBody.name);
985
985
  }
986
986
  const parameterName = sdkBody.name;
987
- const parameter = new Parameter(parameterName, (_a = sdkBody.description) !== null && _a !== void 0 ? _a : "", schema, {
988
- summary: sdkBody.details,
987
+ const parameter = new Parameter(parameterName, (_a = sdkBody.doc) !== null && _a !== void 0 ? _a : "", schema, {
988
+ summary: sdkBody.summary,
989
989
  implementation: ImplementationLocation.Method,
990
990
  required: !sdkBody.optional,
991
991
  protocol: {
@@ -1164,12 +1164,12 @@ export class CodeModelBuilder {
1164
1164
  headers = [];
1165
1165
  if (sdkResponse.headers) {
1166
1166
  for (const header of sdkResponse.headers) {
1167
- const schema = this.processSchemaFromSdkType(header.type, header.serializedName);
1167
+ const schema = this.processSchema(header.type, header.serializedName);
1168
1168
  headers.push(new HttpHeader(header.serializedName, schema, {
1169
1169
  language: {
1170
1170
  default: {
1171
1171
  name: header.serializedName,
1172
- description: (_a = header.description) !== null && _a !== void 0 ? _a : header.details,
1172
+ description: (_a = header.summary) !== null && _a !== void 0 ? _a : header.doc,
1173
1173
  },
1174
1174
  },
1175
1175
  }));
@@ -1208,7 +1208,7 @@ export class CodeModelBuilder {
1208
1208
  trackConvenienceApi = false;
1209
1209
  }
1210
1210
  if (!schema) {
1211
- schema = this.processSchemaFromSdkType(bodyType, op.language.default.name + "Response");
1211
+ schema = this.processSchema(bodyType, op.language.default.name + "Response");
1212
1212
  }
1213
1213
  response = new SchemaResponse(schema, {
1214
1214
  protocol: {
@@ -1277,122 +1277,122 @@ export class CodeModelBuilder {
1277
1277
  .map((it) => it.toString());
1278
1278
  }
1279
1279
  }
1280
- processSchemaFromSdkType(type, nameHint) {
1280
+ processSchema(type, nameHint) {
1281
1281
  return this.schemaCache.process(type, nameHint) || fail("Unable to process schema.");
1282
1282
  }
1283
- processSchemaFromSdkTypeImpl(type, nameHint) {
1283
+ processSchemaImpl(type, nameHint) {
1284
1284
  if (isSdkBuiltInKind(type.kind)) {
1285
- return this.processBuiltInFromSdkType(type, nameHint);
1285
+ return this.processBuiltInType(type, nameHint);
1286
1286
  }
1287
1287
  else {
1288
1288
  switch (type.kind) {
1289
1289
  case "enum":
1290
- return this.processChoiceSchemaFromSdkType(type, type.name);
1290
+ return this.processChoiceSchema(type, type.name);
1291
1291
  case "enumvalue":
1292
- return this.processConstantSchemaFromEnumValueFromSdkType(type, nameHint);
1292
+ return this.processConstantSchemaFromEnumValue(type, nameHint);
1293
1293
  case "union":
1294
- return this.processUnionSchemaFromSdkType(type, type.name);
1294
+ return this.processUnionSchema(type, type.name);
1295
1295
  case "model":
1296
- return this.processObjectSchemaFromSdkType(type, type.name);
1296
+ return this.processObjectSchema(type, type.name);
1297
1297
  case "dict":
1298
- return this.processDictionarySchemaFromSdkType(type, nameHint);
1298
+ return this.processDictionarySchema(type, nameHint);
1299
1299
  case "array":
1300
- return this.processArraySchemaFromSdkType(type, nameHint);
1300
+ return this.processArraySchema(type, nameHint);
1301
1301
  case "duration":
1302
- return this.processDurationSchemaFromSdkType(type, nameHint, getDurationFormatFromSdkType(type));
1302
+ return this.processDurationSchema(type, nameHint, getDurationFormat(type));
1303
1303
  case "constant":
1304
- return this.processConstantSchemaFromSdkType(type, nameHint);
1304
+ return this.processConstantSchema(type, nameHint);
1305
1305
  case "utcDateTime":
1306
1306
  case "offsetDateTime":
1307
1307
  if (type.encode === "unixTimestamp") {
1308
- return this.processUnixTimeSchemaFromSdkType(type, nameHint);
1308
+ return this.processUnixTimeSchema(type, nameHint);
1309
1309
  }
1310
1310
  else {
1311
- return this.processDateTimeSchemaFromSdkType(type, nameHint, type.encode === "rfc7231");
1311
+ return this.processDateTimeSchema(type, nameHint, type.encode === "rfc7231");
1312
1312
  }
1313
1313
  }
1314
1314
  }
1315
1315
  throw new Error(`Unrecognized type: '${type.kind}'.`);
1316
1316
  }
1317
- processBuiltInFromSdkType(type, nameHint) {
1317
+ processBuiltInType(type, nameHint) {
1318
1318
  nameHint = nameHint || type.kind;
1319
1319
  if (isSdkIntKind(type.kind)) {
1320
1320
  const integerSize = type.kind === "safeint" || type.kind.includes("int64") ? 64 : 32;
1321
- return this.processIntegerSchemaFromSdkType(type, nameHint, integerSize);
1321
+ return this.processIntegerSchema(type, nameHint, integerSize);
1322
1322
  }
1323
1323
  else {
1324
1324
  switch (type.kind) {
1325
- case "any":
1326
- return this.processAnySchemaFromSdkType();
1325
+ case "unknown":
1326
+ return this.processAnySchema();
1327
1327
  case "string":
1328
- return this.processStringSchemaFromSdkType(type, nameHint);
1328
+ return this.processStringSchema(type, nameHint);
1329
1329
  case "float":
1330
1330
  case "float32":
1331
1331
  case "float64":
1332
- return this.processNumberSchemaFromSdkType(type, nameHint);
1332
+ return this.processNumberSchema(type, nameHint);
1333
1333
  case "decimal":
1334
1334
  case "decimal128":
1335
- return this.processDecimalSchemaFromSdkType(type, nameHint);
1335
+ return this.processDecimalSchema(type, nameHint);
1336
1336
  case "bytes":
1337
- return this.processByteArraySchemaFromSdkType(type, nameHint);
1337
+ return this.processByteArraySchema(type, nameHint);
1338
1338
  case "boolean":
1339
- return this.processBooleanSchemaFromSdkType(type, nameHint);
1339
+ return this.processBooleanSchema(type, nameHint);
1340
1340
  case "plainTime":
1341
- return this.processTimeSchemaFromSdkType(type, nameHint);
1341
+ return this.processTimeSchema(type, nameHint);
1342
1342
  case "plainDate":
1343
- return this.processDateSchemaFromSdkType(type, nameHint);
1343
+ return this.processDateSchema(type, nameHint);
1344
1344
  case "url":
1345
- return this.processUrlSchemaFromSdkType(type, nameHint);
1345
+ return this.processUrlSchema(type, nameHint);
1346
1346
  }
1347
1347
  }
1348
1348
  }
1349
- processAnySchemaFromSdkType() {
1349
+ processAnySchema() {
1350
1350
  return this.anySchema;
1351
1351
  }
1352
- processStringSchemaFromSdkType(type, name) {
1352
+ processStringSchema(type, name) {
1353
1353
  var _a;
1354
- return this.codeModel.schemas.add(new StringSchema(name, (_a = type.details) !== null && _a !== void 0 ? _a : "", {
1355
- summary: type.description,
1354
+ return this.codeModel.schemas.add(new StringSchema(name, (_a = type.doc) !== null && _a !== void 0 ? _a : "", {
1355
+ summary: type.summary,
1356
1356
  }));
1357
1357
  }
1358
- processByteArraySchemaFromSdkType(type, name) {
1358
+ processByteArraySchema(type, name) {
1359
1359
  var _a;
1360
1360
  const base64Encoded = type.encode === "base64url";
1361
- return this.codeModel.schemas.add(new ByteArraySchema(name, (_a = type.details) !== null && _a !== void 0 ? _a : "", {
1362
- summary: type.description,
1361
+ return this.codeModel.schemas.add(new ByteArraySchema(name, (_a = type.doc) !== null && _a !== void 0 ? _a : "", {
1362
+ summary: type.summary,
1363
1363
  format: base64Encoded ? "base64url" : "byte",
1364
1364
  }));
1365
1365
  }
1366
- processIntegerSchemaFromSdkType(type, name, precision) {
1366
+ processIntegerSchema(type, name, precision) {
1367
1367
  var _a;
1368
- const schema = new NumberSchema(name, (_a = type.details) !== null && _a !== void 0 ? _a : "", SchemaType.Integer, precision, {
1369
- summary: type.description,
1368
+ const schema = new NumberSchema(name, (_a = type.doc) !== null && _a !== void 0 ? _a : "", SchemaType.Integer, precision, {
1369
+ summary: type.summary,
1370
1370
  });
1371
1371
  if (type.encode === "string") {
1372
1372
  schema.encode = type.encode;
1373
1373
  }
1374
1374
  return this.codeModel.schemas.add(schema);
1375
1375
  }
1376
- processNumberSchemaFromSdkType(type, name) {
1376
+ processNumberSchema(type, name) {
1377
1377
  var _a;
1378
- return this.codeModel.schemas.add(new NumberSchema(name, (_a = type.details) !== null && _a !== void 0 ? _a : "", SchemaType.Number, 64, {
1379
- summary: type.description,
1378
+ return this.codeModel.schemas.add(new NumberSchema(name, (_a = type.doc) !== null && _a !== void 0 ? _a : "", SchemaType.Number, 64, {
1379
+ summary: type.summary,
1380
1380
  }));
1381
1381
  }
1382
- processDecimalSchemaFromSdkType(type, name) {
1382
+ processDecimalSchema(type, name) {
1383
1383
  var _a;
1384
1384
  // "Infinity" maps to "BigDecimal" in Java
1385
- return this.codeModel.schemas.add(new NumberSchema(name, (_a = type.details) !== null && _a !== void 0 ? _a : "", SchemaType.Number, Infinity, {
1386
- summary: type.description,
1385
+ return this.codeModel.schemas.add(new NumberSchema(name, (_a = type.doc) !== null && _a !== void 0 ? _a : "", SchemaType.Number, Infinity, {
1386
+ summary: type.summary,
1387
1387
  }));
1388
1388
  }
1389
- processBooleanSchemaFromSdkType(type, name) {
1389
+ processBooleanSchema(type, name) {
1390
1390
  var _a;
1391
- return this.codeModel.schemas.add(new BooleanSchema(name, (_a = type.details) !== null && _a !== void 0 ? _a : "", {
1392
- summary: type.description,
1391
+ return this.codeModel.schemas.add(new BooleanSchema(name, (_a = type.doc) !== null && _a !== void 0 ? _a : "", {
1392
+ summary: type.summary,
1393
1393
  }));
1394
1394
  }
1395
- processArraySchemaFromSdkType(type, name) {
1395
+ processArraySchema(type, name) {
1396
1396
  var _a;
1397
1397
  let nullableItems = false;
1398
1398
  let elementType = type.valueType;
@@ -1400,16 +1400,16 @@ export class CodeModelBuilder {
1400
1400
  nullableItems = true;
1401
1401
  elementType = elementType.type;
1402
1402
  }
1403
- const elementSchema = this.processSchemaFromSdkType(elementType, name);
1404
- return this.codeModel.schemas.add(new ArraySchema(name, (_a = type.details) !== null && _a !== void 0 ? _a : "", elementSchema, {
1405
- summary: type.description,
1403
+ const elementSchema = this.processSchema(elementType, name);
1404
+ return this.codeModel.schemas.add(new ArraySchema(name, (_a = type.doc) !== null && _a !== void 0 ? _a : "", elementSchema, {
1405
+ summary: type.summary,
1406
1406
  nullableItems: nullableItems,
1407
1407
  }));
1408
1408
  }
1409
- processDictionarySchemaFromSdkType(type, name) {
1409
+ processDictionarySchema(type, name) {
1410
1410
  var _a;
1411
- const dictSchema = new DictionarySchema(name, (_a = type.details) !== null && _a !== void 0 ? _a : "", null, {
1412
- summary: type.description,
1411
+ const dictSchema = new DictionarySchema(name, (_a = type.doc) !== null && _a !== void 0 ? _a : "", null, {
1412
+ summary: type.summary,
1413
1413
  });
1414
1414
  // cache this now before we accidentally recurse on this type.
1415
1415
  if (!this.schemaCache.has(type)) {
@@ -1421,21 +1421,21 @@ export class CodeModelBuilder {
1421
1421
  nullableItems = true;
1422
1422
  elementType = elementType.type;
1423
1423
  }
1424
- const elementSchema = this.processSchemaFromSdkType(elementType, name);
1424
+ const elementSchema = this.processSchema(elementType, name);
1425
1425
  dictSchema.elementType = elementSchema;
1426
1426
  dictSchema.nullableItems = nullableItems;
1427
1427
  return this.codeModel.schemas.add(dictSchema);
1428
1428
  }
1429
- processChoiceSchemaFromSdkType(type, name) {
1429
+ processChoiceSchema(type, name) {
1430
1430
  var _a, _b;
1431
1431
  const rawEnumType = type.__raw;
1432
1432
  const namespace = getNamespace(rawEnumType);
1433
- const valueType = this.processSchemaFromSdkType(type.valueType, type.valueType.kind);
1433
+ const valueType = this.processSchema(type.valueType, type.valueType.kind);
1434
1434
  const choices = [];
1435
- type.values.forEach((it) => { var _a, _b; return choices.push(new ChoiceValue(it.name, (_a = it.description) !== null && _a !== void 0 ? _a : "", (_b = it.value) !== null && _b !== void 0 ? _b : it.name)); });
1435
+ type.values.forEach((it) => { var _a, _b; return choices.push(new ChoiceValue(it.name, (_a = it.doc) !== null && _a !== void 0 ? _a : "", (_b = it.value) !== null && _b !== void 0 ? _b : it.name)); });
1436
1436
  const schemaType = type.isFixed ? SealedChoiceSchema : ChoiceSchema;
1437
- const schema = new schemaType((_a = type.name) !== null && _a !== void 0 ? _a : name, (_b = type.details) !== null && _b !== void 0 ? _b : "", {
1438
- summary: type.description,
1437
+ const schema = new schemaType((_a = type.name) !== null && _a !== void 0 ? _a : name, (_b = type.doc) !== null && _b !== void 0 ? _b : "", {
1438
+ summary: type.summary,
1439
1439
  choiceType: valueType,
1440
1440
  choices: choices,
1441
1441
  language: {
@@ -1450,68 +1450,68 @@ export class CodeModelBuilder {
1450
1450
  schema.crossLanguageDefinitionId = type.crossLanguageDefinitionId;
1451
1451
  return this.codeModel.schemas.add(schema);
1452
1452
  }
1453
- processConstantSchemaFromSdkType(type, name) {
1453
+ processConstantSchema(type, name) {
1454
1454
  var _a, _b;
1455
- const valueType = this.processSchemaFromSdkType(type.valueType, type.valueType.kind);
1456
- return this.codeModel.schemas.add(new ConstantSchema((_a = type.name) !== null && _a !== void 0 ? _a : name, (_b = type.details) !== null && _b !== void 0 ? _b : "", {
1457
- summary: type.description,
1455
+ const valueType = this.processSchema(type.valueType, type.valueType.kind);
1456
+ return this.codeModel.schemas.add(new ConstantSchema((_a = type.name) !== null && _a !== void 0 ? _a : name, (_b = type.doc) !== null && _b !== void 0 ? _b : "", {
1457
+ summary: type.summary,
1458
1458
  valueType: valueType,
1459
1459
  value: new ConstantValue(type.value),
1460
1460
  }));
1461
1461
  }
1462
- processConstantSchemaFromEnumValueFromSdkType(type, name) {
1462
+ processConstantSchemaFromEnumValue(type, name) {
1463
1463
  var _a, _b, _c;
1464
- const valueType = this.processSchemaFromSdkType(type.enumType, type.enumType.name);
1465
- return this.codeModel.schemas.add(new ConstantSchema((_a = type.name) !== null && _a !== void 0 ? _a : name, (_b = type.details) !== null && _b !== void 0 ? _b : "", {
1466
- summary: type.description,
1464
+ const valueType = this.processSchema(type.enumType, type.enumType.name);
1465
+ return this.codeModel.schemas.add(new ConstantSchema((_a = type.name) !== null && _a !== void 0 ? _a : name, (_b = type.doc) !== null && _b !== void 0 ? _b : "", {
1466
+ summary: type.summary,
1467
1467
  valueType: valueType,
1468
1468
  value: new ConstantValue((_c = type.value) !== null && _c !== void 0 ? _c : type.name),
1469
1469
  }));
1470
1470
  }
1471
- processUnixTimeSchemaFromSdkType(type, name) {
1471
+ processUnixTimeSchema(type, name) {
1472
1472
  var _a;
1473
- return this.codeModel.schemas.add(new UnixTimeSchema(name, (_a = type.details) !== null && _a !== void 0 ? _a : "", {
1474
- summary: type.description,
1473
+ return this.codeModel.schemas.add(new UnixTimeSchema(name, (_a = type.doc) !== null && _a !== void 0 ? _a : "", {
1474
+ summary: type.summary,
1475
1475
  }));
1476
1476
  }
1477
- processDateTimeSchemaFromSdkType(type, name, rfc1123) {
1477
+ processDateTimeSchema(type, name, rfc1123) {
1478
1478
  var _a;
1479
- return this.codeModel.schemas.add(new DateTimeSchema(name, (_a = type.details) !== null && _a !== void 0 ? _a : "", {
1480
- summary: type.description,
1479
+ return this.codeModel.schemas.add(new DateTimeSchema(name, (_a = type.doc) !== null && _a !== void 0 ? _a : "", {
1480
+ summary: type.summary,
1481
1481
  format: rfc1123 ? "date-time-rfc1123" : "date-time",
1482
1482
  }));
1483
1483
  }
1484
- processDateSchemaFromSdkType(type, name) {
1484
+ processDateSchema(type, name) {
1485
1485
  var _a;
1486
- return this.codeModel.schemas.add(new DateSchema(name, (_a = type.details) !== null && _a !== void 0 ? _a : "", {
1487
- summary: type.description,
1486
+ return this.codeModel.schemas.add(new DateSchema(name, (_a = type.doc) !== null && _a !== void 0 ? _a : "", {
1487
+ summary: type.summary,
1488
1488
  }));
1489
1489
  }
1490
- processTimeSchemaFromSdkType(type, name) {
1490
+ processTimeSchema(type, name) {
1491
1491
  var _a;
1492
- return this.codeModel.schemas.add(new TimeSchema(name, (_a = type.details) !== null && _a !== void 0 ? _a : "", {
1493
- summary: type.description,
1492
+ return this.codeModel.schemas.add(new TimeSchema(name, (_a = type.doc) !== null && _a !== void 0 ? _a : "", {
1493
+ summary: type.summary,
1494
1494
  }));
1495
1495
  }
1496
- processDurationSchemaFromSdkType(type, name, format = "duration-rfc3339") {
1496
+ processDurationSchema(type, name, format = "duration-rfc3339") {
1497
1497
  var _a;
1498
- return this.codeModel.schemas.add(new DurationSchema(name, (_a = type.details) !== null && _a !== void 0 ? _a : "", {
1499
- summary: type.description,
1498
+ return this.codeModel.schemas.add(new DurationSchema(name, (_a = type.doc) !== null && _a !== void 0 ? _a : "", {
1499
+ summary: type.summary,
1500
1500
  format: format,
1501
1501
  }));
1502
1502
  }
1503
- processUrlSchemaFromSdkType(type, name) {
1503
+ processUrlSchema(type, name) {
1504
1504
  var _a;
1505
- return this.codeModel.schemas.add(new UriSchema(name, (_a = type.details) !== null && _a !== void 0 ? _a : "", {
1506
- summary: type.description,
1505
+ return this.codeModel.schemas.add(new UriSchema(name, (_a = type.doc) !== null && _a !== void 0 ? _a : "", {
1506
+ summary: type.summary,
1507
1507
  }));
1508
1508
  }
1509
- processObjectSchemaFromSdkType(type, name) {
1509
+ processObjectSchema(type, name) {
1510
1510
  var _a, _b;
1511
1511
  const rawModelType = type.__raw;
1512
1512
  const namespace = getNamespace(rawModelType);
1513
- const objectSchema = new ObjectSchema(name, (_a = type.details) !== null && _a !== void 0 ? _a : "", {
1514
- summary: type.description,
1513
+ const objectSchema = new ObjectSchema(name, (_a = type.doc) !== null && _a !== void 0 ? _a : "", {
1514
+ summary: type.summary,
1515
1515
  language: {
1516
1516
  default: {
1517
1517
  namespace: namespace,
@@ -1530,15 +1530,15 @@ export class CodeModelBuilder {
1530
1530
  }
1531
1531
  // discriminator
1532
1532
  if (type.discriminatedSubtypes && type.discriminatorProperty) {
1533
- objectSchema.discriminator = new Discriminator(this.processModelPropertyFromSdkType(type.discriminatorProperty));
1533
+ objectSchema.discriminator = new Discriminator(this.processModelProperty(type.discriminatorProperty));
1534
1534
  for (const discriminatorValue in type.discriminatedSubtypes) {
1535
1535
  const subType = type.discriminatedSubtypes[discriminatorValue];
1536
- this.processSchemaFromSdkType(subType, subType.name);
1536
+ this.processSchema(subType, subType.name);
1537
1537
  }
1538
1538
  }
1539
1539
  // type is a subtype
1540
1540
  if (type.baseModel) {
1541
- const parentSchema = this.processSchemaFromSdkType(type.baseModel, type.baseModel.name);
1541
+ const parentSchema = this.processSchema(type.baseModel, type.baseModel.name);
1542
1542
  objectSchema.parents = new Relations();
1543
1543
  objectSchema.parents.immediate.push(parentSchema);
1544
1544
  if (parentSchema instanceof ObjectSchema) {
@@ -1568,11 +1568,11 @@ export class CodeModelBuilder {
1568
1568
  name: "string",
1569
1569
  crossLanguageDefinitionId: type.crossLanguageDefinitionId,
1570
1570
  },
1571
- description: type.description,
1571
+ description: type.doc,
1572
1572
  valueType: type.additionalProperties,
1573
1573
  decorators: [],
1574
1574
  };
1575
- const parentSchema = this.processSchemaFromSdkType(sdkDictType, "Record");
1575
+ const parentSchema = this.processSchema(sdkDictType, "Record");
1576
1576
  objectSchema.parents = (_b = objectSchema.parents) !== null && _b !== void 0 ? _b : new Relations();
1577
1577
  objectSchema.parents.immediate.push(parentSchema);
1578
1578
  pushDistinct(objectSchema.parents.all, parentSchema);
@@ -1581,7 +1581,7 @@ export class CodeModelBuilder {
1581
1581
  // properties
1582
1582
  for (const prop of type.properties) {
1583
1583
  if (prop.kind === "property" && !prop.discriminator) {
1584
- objectSchema.addProperty(this.processModelPropertyFromSdkType(prop));
1584
+ objectSchema.addProperty(this.processModelProperty(prop));
1585
1585
  }
1586
1586
  }
1587
1587
  return objectSchema;
@@ -1604,7 +1604,7 @@ export class CodeModelBuilder {
1604
1604
  }
1605
1605
  return type;
1606
1606
  }
1607
- processModelPropertyFromSdkType(prop) {
1607
+ processModelProperty(prop) {
1608
1608
  var _a;
1609
1609
  let nullable = false;
1610
1610
  let nonNullType = prop.type;
@@ -1632,22 +1632,22 @@ export class CodeModelBuilder {
1632
1632
  if (prop.kind === "property" && prop.multipartOptions) {
1633
1633
  // TODO: handle MultipartOptions.isMulti
1634
1634
  if (prop.multipartOptions.isFilePart) {
1635
- schema = this.processMultipartFormDataFilePropertySchemaFromSdkType(prop);
1635
+ schema = this.processMultipartFormDataFilePropertySchema(prop);
1636
1636
  }
1637
1637
  else if (prop.type.kind === "model" &&
1638
1638
  prop.type.properties.some((it) => it.kind === "body")) {
1639
1639
  // TODO: this is HttpPart of non-File. TCGC should help handle this.
1640
- schema = this.processSchemaFromSdkType(prop.type.properties.find((it) => it.kind === "body").type, "");
1640
+ schema = this.processSchema(prop.type.properties.find((it) => it.kind === "body").type, "");
1641
1641
  }
1642
1642
  else {
1643
- schema = this.processSchemaFromSdkType(nonNullType, "");
1643
+ schema = this.processSchema(nonNullType, "");
1644
1644
  }
1645
1645
  }
1646
1646
  else {
1647
- schema = this.processSchemaFromSdkType(nonNullType, "");
1647
+ schema = this.processSchema(nonNullType, "");
1648
1648
  }
1649
- return new Property(prop.name, (_a = prop.details) !== null && _a !== void 0 ? _a : "", schema, {
1650
- summary: prop.description,
1649
+ return new Property(prop.name, (_a = prop.doc) !== null && _a !== void 0 ? _a : "", schema, {
1650
+ summary: prop.summary,
1651
1651
  required: !prop.optional,
1652
1652
  nullable: nullable,
1653
1653
  readOnly: this.isReadOnly(prop),
@@ -1655,7 +1655,7 @@ export class CodeModelBuilder {
1655
1655
  extensions: extensions,
1656
1656
  });
1657
1657
  }
1658
- processUnionSchemaFromSdkType(type, name) {
1658
+ processUnionSchema(type, name) {
1659
1659
  var _a, _b;
1660
1660
  if (!(type.__raw && type.__raw.kind === "Union")) {
1661
1661
  throw new Error(`Invalid type for union: '${type.kind}'.`);
@@ -1664,18 +1664,18 @@ export class CodeModelBuilder {
1664
1664
  const namespace = getNamespace(rawUnionType);
1665
1665
  const baseName = (_a = type.name) !== null && _a !== void 0 ? _a : pascalCase(name) + "Model";
1666
1666
  this.logWarning(`Convert TypeSpec Union '${getUnionDescription(rawUnionType, this.typeNameOptions)}' to Class '${baseName}'`);
1667
- const unionSchema = new OrSchema(baseName + "Base", (_b = type.details) !== null && _b !== void 0 ? _b : "", {
1668
- summary: type.description,
1667
+ const unionSchema = new OrSchema(baseName + "Base", (_b = type.doc) !== null && _b !== void 0 ? _b : "", {
1668
+ summary: type.summary,
1669
1669
  });
1670
1670
  unionSchema.anyOf = [];
1671
- type.values.forEach((it) => {
1671
+ type.variantTypes.forEach((it) => {
1672
1672
  var _a, _b;
1673
1673
  const variantName = this.getUnionVariantName(it.__raw, { depth: 0 });
1674
1674
  const modelName = variantName + baseName;
1675
1675
  const propertyName = "value";
1676
1676
  // these ObjectSchema is not added to codeModel.schemas
1677
- const objectSchema = new ObjectSchema(modelName, (_a = it.details) !== null && _a !== void 0 ? _a : "", {
1678
- summary: it.description,
1677
+ const objectSchema = new ObjectSchema(modelName, (_a = it.doc) !== null && _a !== void 0 ? _a : "", {
1678
+ summary: it.summary,
1679
1679
  language: {
1680
1680
  default: {
1681
1681
  namespace: namespace,
@@ -1685,9 +1685,9 @@ export class CodeModelBuilder {
1685
1685
  },
1686
1686
  },
1687
1687
  });
1688
- const variantSchema = this.processSchemaFromSdkType(it, variantName);
1689
- objectSchema.addProperty(new Property(propertyName, (_b = type.details) !== null && _b !== void 0 ? _b : "", variantSchema, {
1690
- summary: type.description,
1688
+ const variantSchema = this.processSchema(it, variantName);
1689
+ objectSchema.addProperty(new Property(propertyName, (_b = type.doc) !== null && _b !== void 0 ? _b : "", variantSchema, {
1690
+ summary: type.summary,
1691
1691
  required: true,
1692
1692
  readOnly: false,
1693
1693
  }));
@@ -1695,10 +1695,10 @@ export class CodeModelBuilder {
1695
1695
  });
1696
1696
  return this.codeModel.schemas.add(unionSchema);
1697
1697
  }
1698
- processBinarySchemaFromSdkType(type) {
1698
+ processBinarySchema(type) {
1699
1699
  var _a;
1700
- return this.codeModel.schemas.add(new BinarySchema((_a = type.description) !== null && _a !== void 0 ? _a : "", {
1701
- summary: type.details,
1700
+ return this.codeModel.schemas.add(new BinarySchema((_a = type.doc) !== null && _a !== void 0 ? _a : "", {
1701
+ summary: type.summary,
1702
1702
  }));
1703
1703
  }
1704
1704
  getUnionVariantName(type, option) {
@@ -1762,9 +1762,9 @@ export class CodeModelBuilder {
1762
1762
  throw new Error(`Unrecognized type for union variable: '${type.kind}'.`);
1763
1763
  }
1764
1764
  }
1765
- processMultipartFormDataFilePropertySchemaFromSdkType(property) {
1765
+ processMultipartFormDataFilePropertySchema(property) {
1766
1766
  var _a, _b, _c, _d;
1767
- const processSchemaFunc = (type) => this.processSchemaFromSdkType(type, "");
1767
+ const processSchemaFunc = (type) => this.processSchema(type, "");
1768
1768
  if (property.type.kind === "bytes" || property.type.kind === "model") {
1769
1769
  const namespace = property.type.kind === "model"
1770
1770
  ? ((_a = getNamespace(property.type.__raw)) !== null && _a !== void 0 ? _a : this.namespace)
@@ -1777,7 +1777,7 @@ export class CodeModelBuilder {
1777
1777
  ? ((_c = getNamespace(property.type.valueType.__raw)) !== null && _c !== void 0 ? _c : this.namespace)
1778
1778
  : this.namespace;
1779
1779
  return new ArraySchema(property.name, (_d = property.details) !== null && _d !== void 0 ? _d : "", getFileDetailsSchema(property, namespace, this.getJavaNamespace(namespace), this.codeModel.schemas, this.binarySchema, this.stringSchema, processSchemaFunc), {
1780
- summary: property.description,
1780
+ summary: property.summary,
1781
1781
  });
1782
1782
  }
1783
1783
  else {
@@ -1947,7 +1947,7 @@ export class CodeModelBuilder {
1947
1947
  }
1948
1948
  subscriptionIdParameter(parameter) {
1949
1949
  if (!this._subscriptionParameter) {
1950
- const description = parameter.description;
1950
+ const description = parameter.doc;
1951
1951
  this._subscriptionParameter = new Parameter("subscriptionId", description ? description : "The ID of the target subscription.", this.stringSchema, {
1952
1952
  implementation: ImplementationLocation.Client,
1953
1953
  required: true,