@azure-tools/typespec-java 0.20.1 → 0.20.2

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.
Files changed (66) hide show
  1. package/dist/src/code-model-builder.d.ts.map +1 -1
  2. package/dist/src/code-model-builder.js +67 -36
  3. package/dist/src/code-model-builder.js.map +1 -1
  4. package/dist/src/common/client.d.ts +1 -1
  5. package/dist/src/common/client.d.ts.map +1 -1
  6. package/dist/src/common/client.js +1 -0
  7. package/dist/src/common/client.js.map +1 -1
  8. package/dist/src/common/code-model.d.ts +1 -1
  9. package/dist/src/common/code-model.d.ts.map +1 -1
  10. package/dist/src/common/code-model.js +2 -1
  11. package/dist/src/common/code-model.js.map +1 -1
  12. package/dist/src/common/operation.d.ts +2 -2
  13. package/dist/src/common/operation.d.ts.map +1 -1
  14. package/dist/src/common/operation.js +2 -1
  15. package/dist/src/common/operation.js.map +1 -1
  16. package/dist/src/common/schemas/choice.d.ts.map +1 -1
  17. package/dist/src/common/schemas/choice.js +2 -1
  18. package/dist/src/common/schemas/choice.js.map +1 -1
  19. package/dist/src/common/schemas/constant.d.ts +1 -1
  20. package/dist/src/common/schemas/constant.d.ts.map +1 -1
  21. package/dist/src/common/schemas/constant.js +1 -0
  22. package/dist/src/common/schemas/constant.js.map +1 -1
  23. package/dist/src/common/schemas/relationship.d.ts +2 -3
  24. package/dist/src/common/schemas/relationship.d.ts.map +1 -1
  25. package/dist/src/common/schemas/relationship.js +2 -2
  26. package/dist/src/common/schemas/relationship.js.map +1 -1
  27. package/dist/src/common/schemas/time.d.ts +1 -1
  28. package/dist/src/common/schemas/time.d.ts.map +1 -1
  29. package/dist/src/common/schemas/time.js +1 -0
  30. package/dist/src/common/schemas/time.js.map +1 -1
  31. package/dist/src/emitter.d.ts +5 -6
  32. package/dist/src/emitter.d.ts.map +1 -1
  33. package/dist/src/emitter.js +12 -14
  34. package/dist/src/emitter.js.map +1 -1
  35. package/dist/src/external-schemas.d.ts.map +1 -1
  36. package/dist/src/external-schemas.js +3 -2
  37. package/dist/src/external-schemas.js.map +1 -1
  38. package/dist/src/models.d.ts +2 -2
  39. package/dist/src/models.d.ts.map +1 -1
  40. package/dist/src/models.js.map +1 -1
  41. package/dist/src/operation-utils.d.ts +3 -3
  42. package/dist/src/operation-utils.d.ts.map +1 -1
  43. package/dist/src/operation-utils.js +2 -2
  44. package/dist/src/operation-utils.js.map +1 -1
  45. package/dist/src/type-utils.d.ts +2 -2
  46. package/dist/src/type-utils.d.ts.map +1 -1
  47. package/dist/src/type-utils.js +23 -10
  48. package/dist/src/type-utils.js.map +1 -1
  49. package/dist/src/utils.d.ts.map +1 -1
  50. package/dist/src/utils.js +10 -4
  51. package/dist/src/utils.js.map +1 -1
  52. package/dist/tsconfig.tsbuildinfo +1 -1
  53. package/{target → generator/http-client-generator/target}/emitter.jar +0 -0
  54. package/package.json +2 -2
  55. package/dist/src/prenamer/formatter.d.ts +0 -11
  56. package/dist/src/prenamer/formatter.d.ts.map +0 -1
  57. package/dist/src/prenamer/formatter.js +0 -124
  58. package/dist/src/prenamer/formatter.js.map +0 -1
  59. package/dist/src/prenamer/naming-utils.d.ts +0 -67
  60. package/dist/src/prenamer/naming-utils.d.ts.map +0 -1
  61. package/dist/src/prenamer/naming-utils.js +0 -147
  62. package/dist/src/prenamer/naming-utils.js.map +0 -1
  63. package/dist/src/prenamer/prenamer.d.ts +0 -36
  64. package/dist/src/prenamer/prenamer.d.ts.map +0 -1
  65. package/dist/src/prenamer/prenamer.js +0 -333
  66. package/dist/src/prenamer/prenamer.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"code-model-builder.d.ts","sourceRoot":"","sources":["../../src/code-model-builder.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EAIT,YAAY,EACZ,aAAa,EAeb,YAAY,EAEZ,YAAY,EAEZ,SAAS,EAKT,MAAM,EAMN,YAAY,EAKb,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAwBL,OA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oBlB,OAAO,CAAC,QAAQ;IAQhB,OAAO,CAAC,aAAa;IAuBrB,OAAO,CAAC,qBAAqB;IAS7B,OAAO,CAAC,gBAAgB;IAexB,OAAO,CAAC,UAAU;IAMlB,OAAO,CAAC,KAAK;IAIb,OAAO,CAAC,aAAa,CAAC,CAAe;IACrC,IAAI,YAAY,IAAI,YAAY,CAK/B;IAED,OAAO,CAAC,cAAc,CAAC,CAAe;IACtC,IAAI,aAAa,IAAI,YAAY,CAOhC;IAED,OAAO,CAAC,aAAa,CAAC,CAAe;IACrC,IAAI,YAAY,IAAI,YAAY,CAO/B;IAED,OAAO,CAAC,cAAc,CAAC,CAAgB;IACvC,IAAI,aAAa,IAAI,aAAa,CAOjC;IAED,OAAO,CAAC,UAAU,CAAC,CAAY;IAC/B,IAAI,SAAS,IAAI,SAAS,CAIzB;IAED,OAAO,CAAC,aAAa,CAAC,CAAe;IACrC,IAAI,YAAY,IAAI,YAAY,CAK/B;IAED,OAAO,CAAC,iBAAiB,CAAC,CAAe;IACzC,IAAI,gBAAgB,IAAI,YAAY,CAQnC;IAED,OAAO,CAAC,yBAAyB;IA8BjC,OAAO,CAAC,oBAAoB,CAAC,CAAY;IACzC,IAAI,mBAAmB,IAAI,SAAS,CAQnC;IAED,OAAO,CAAC,0BAA0B,CAAC,CAAY;IAC/C,IAAI,yBAAyB,IAAI,SAAS,CASzC;IAED,OAAO,CAAC,gBAAgB;IAIxB,OAAO,CAAC,uBAAuB;IAwB/B,OAAO,CAAC,sBAAsB,CAAC,CAAY;IAE3C,OAAO,CAAC,oBAAoB;IA+E5B,OAAO,CAAC,gBAAgB;IAyBxB,OAAO,CAAC,KAAK;CAGd"}
@@ -7,7 +7,7 @@ import { getSegment } from "@typespec/rest";
7
7
  import { getAddedOnVersions } from "@typespec/versioning";
8
8
  import { fail } from "assert";
9
9
  import pkg from "lodash";
10
- import { Client as CodeModelClient } from "./common/client.js";
10
+ import { Client as CodeModelClient, } from "./common/client.js";
11
11
  import { CodeModel } from "./common/code-model.js";
12
12
  import { LongRunningMetadata } from "./common/long-running-metadata.js";
13
13
  import { Operation as CodeModelOperation, ConvenienceApi, Request } from "./common/operation.js";
@@ -19,7 +19,6 @@ 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 { PreNamer } from "./prenamer/prenamer.js";
23
22
  import { ProcessingCache, getAccess, getDurationFormatFromSdkType, getNonNullSdkType, getUnionDescription, getUsage, isStable, modelIs, pushDistinct, } from "./type-utils.js";
24
23
  import { getNamespace, logWarning, pascalCase, removeClientSuffix, stringArrayContainsIgnoreCase, trace, } from "./utils.js";
25
24
  const { isEqual } = pkg;
@@ -39,12 +38,11 @@ export class CodeModelBuilder {
39
38
  this.options["skip-special-headers"].forEach((it) => SPECIAL_HEADER_NAMES.add(it.toLowerCase()));
40
39
  }
41
40
  const service = listServices(this.program)[0];
42
- const serviceNamespace = service.type;
43
- if (serviceNamespace === undefined) {
44
- throw Error("Cannot emit yaml for a namespace that doesn't exist.");
41
+ if (!service) {
42
+ throw Error("TypeSpec for HTTP must define a service.");
45
43
  }
46
- this.serviceNamespace = serviceNamespace;
47
- this.namespace = getNamespaceFullName(serviceNamespace) || "Azure.Client";
44
+ this.serviceNamespace = service.type;
45
+ this.namespace = getNamespaceFullName(this.serviceNamespace) || "Azure.Client";
48
46
  // java namespace
49
47
  const javaNamespace = this.getJavaNamespace(this.namespace);
50
48
  const namespace1 = this.namespace;
@@ -56,8 +54,8 @@ export class CodeModelBuilder {
56
54
  },
57
55
  };
58
56
  // init code model
59
- const title = (_b = this.options["service-name"]) !== null && _b !== void 0 ? _b : serviceNamespace.name;
60
- const description = this.getDoc(serviceNamespace);
57
+ const title = (_b = this.options["service-name"]) !== null && _b !== void 0 ? _b : this.serviceNamespace.name;
58
+ const description = this.getDoc(this.serviceNamespace);
61
59
  this.codeModel = new CodeModel(title, false, {
62
60
  info: {
63
61
  description: description,
@@ -66,7 +64,7 @@ export class CodeModelBuilder {
66
64
  default: {
67
65
  name: title,
68
66
  description: description,
69
- summary: this.getSummary(serviceNamespace),
67
+ summary: this.getSummary(this.serviceNamespace),
70
68
  namespace: this.namespace,
71
69
  },
72
70
  java: {
@@ -93,9 +91,6 @@ export class CodeModelBuilder {
93
91
  this.processClients();
94
92
  this.processModels();
95
93
  this.processSchemaUsage();
96
- if (this.options.namer) {
97
- this.codeModel = new PreNamer(this.codeModel).init().process();
98
- }
99
94
  this.deduplicateSchemaName();
100
95
  return this.codeModel;
101
96
  }
@@ -121,7 +116,7 @@ export class CodeModelBuilder {
121
116
  },
122
117
  language: {
123
118
  default: {
124
- serializedName: arg.name,
119
+ serializedName: arg.serializedName,
125
120
  },
126
121
  },
127
122
  // TODO: deprecate this logic of string/url for x-ms-skip-url-encoding
@@ -436,7 +431,8 @@ export class CodeModelBuilder {
436
431
  const subClient = method.response;
437
432
  if (!isRootClient) {
438
433
  // if it is not root client, append the parent client's name
439
- subClient.name = removeClientSuffix(client.name) + removeClientSuffix(pascalCase(subClient.name));
434
+ subClient.name =
435
+ removeClientSuffix(client.name) + removeClientSuffix(pascalCase(subClient.name));
440
436
  }
441
437
  operationGroups.push(subClient);
442
438
  if (includeNestedOperationGroups) {
@@ -523,7 +519,8 @@ export class CodeModelBuilder {
523
519
  "x-ms-examples": operationExamples,
524
520
  },
525
521
  });
526
- codeModelOperation.crossLanguageDefinitionId = sdkMethod.crossLanguageDefintionId;
522
+ codeModelOperation.crossLanguageDefinitionId =
523
+ sdkMethod.crossLanguageDefintionId;
527
524
  codeModelOperation.internalApi = sdkMethod.access === "internal";
528
525
  const convenienceApiName = this.getConvenienceApiName(sdkMethod);
529
526
  let generateConvenienceApi = sdkMethod.generateConvenient;
@@ -544,7 +541,8 @@ export class CodeModelBuilder {
544
541
  apiComment = `Convenience API is not generated, as operation '${operationName}' is multiple content-type`;
545
542
  this.logWarning(apiComment);
546
543
  }
547
- else if (operationIsJsonMergePatch(httpOperation) && this.options["stream-style-serialization"] === false) {
544
+ else if (operationIsJsonMergePatch(httpOperation) &&
545
+ this.options["stream-style-serialization"] === false) {
548
546
  // do not generate convenient method for json merge patch operation if stream-style-serialization is not enabled
549
547
  generateConvenienceApi = false;
550
548
  apiComment = `Convenience API is not generated, as operation '${operationName}' is 'application/merge-patch+json' and stream-style-serialization is not enabled`;
@@ -680,7 +678,9 @@ export class CodeModelBuilder {
680
678
  lroMetadata.finalEnvelopeResult &&
681
679
  lroMetadata.finalResult !== "void" &&
682
680
  lroMetadata.finalEnvelopeResult !== "void") {
683
- const finalResult = useNewPollStrategy ? lroMetadata.finalResult : lroMetadata.finalEnvelopeResult;
681
+ const finalResult = useNewPollStrategy
682
+ ? lroMetadata.finalResult
683
+ : lroMetadata.finalEnvelopeResult;
684
684
  const finalType = this.findResponseBody(finalResult);
685
685
  const sdkType = getClientType(this.sdkContext, finalType);
686
686
  finalSchema = this.processSchemaFromSdkType(sdkType, "finalResult");
@@ -747,7 +747,8 @@ export class CodeModelBuilder {
747
747
  op.addParameter(parameter);
748
748
  clientContext.addGlobalParameter(parameter);
749
749
  }
750
- else if (param.kind === "header" && SPECIAL_HEADER_NAMES.has(param.serializedName.toLowerCase())) {
750
+ else if (param.kind === "header" &&
751
+ SPECIAL_HEADER_NAMES.has(param.serializedName.toLowerCase())) {
751
752
  // special headers
752
753
  op.specialHeaders = (_a = op.specialHeaders) !== null && _a !== void 0 ? _a : [];
753
754
  if (!stringArrayContainsIgnoreCase(op.specialHeaders, param.serializedName)) {
@@ -806,6 +807,10 @@ export class CodeModelBuilder {
806
807
  explode = true;
807
808
  break;
808
809
  }
810
+ if (param.explode && !param.collectionFormat) {
811
+ style = SerializationStyle.Form;
812
+ explode = true;
813
+ }
809
814
  }
810
815
  else if (param.kind === "header") {
811
816
  const format = param.collectionFormat;
@@ -843,7 +848,9 @@ export class CodeModelBuilder {
843
848
  op.addParameter(parameter);
844
849
  this.trackSchemaUsage(schema, { usage: [SchemaContext.Input] });
845
850
  if (op.convenienceApi) {
846
- this.trackSchemaUsage(schema, { usage: [op.internalApi ? SchemaContext.Internal : SchemaContext.Public] });
851
+ this.trackSchemaUsage(schema, {
852
+ usage: [op.internalApi ? SchemaContext.Internal : SchemaContext.Public],
853
+ });
847
854
  }
848
855
  }
849
856
  }
@@ -873,7 +880,8 @@ export class CodeModelBuilder {
873
880
  }
874
881
  else if (etagHeaders.length === 2) {
875
882
  const etagHeadersLowerCase = etagHeaders.map((it) => it.toLowerCase());
876
- if (etagHeadersLowerCase.includes("if-match") && etagHeadersLowerCase.includes("if-none-match")) {
883
+ if (etagHeadersLowerCase.includes("if-match") &&
884
+ etagHeadersLowerCase.includes("if-none-match")) {
877
885
  // only 2 headers available, use MatchConditions
878
886
  groupToMatchConditions = true;
879
887
  }
@@ -975,11 +983,14 @@ export class CodeModelBuilder {
975
983
  });
976
984
  op.addParameter(parameter);
977
985
  const jsonMergePatch = operationIsJsonMergePatch(sdkHttpOperation);
978
- const schemaIsPublicBeforeProcess = schema instanceof ObjectSchema && ((_b = schema.usage) === null || _b === void 0 ? void 0 : _b.includes(SchemaContext.Public));
986
+ const schemaIsPublicBeforeProcess = schema instanceof ObjectSchema &&
987
+ ((_b = schema.usage) === null || _b === void 0 ? void 0 : _b.includes(SchemaContext.Public));
979
988
  this.trackSchemaUsage(schema, { usage: [SchemaContext.Input] });
980
989
  if (op.convenienceApi) {
981
990
  // model/schema does not need to be Public or Internal, if it is not to be used in convenience API
982
- this.trackSchemaUsage(schema, { usage: [op.internalApi ? SchemaContext.Internal : SchemaContext.Public] });
991
+ this.trackSchemaUsage(schema, {
992
+ usage: [op.internalApi ? SchemaContext.Internal : SchemaContext.Public],
993
+ });
983
994
  }
984
995
  if (jsonMergePatch) {
985
996
  this.trackSchemaUsage(schema, { usage: [SchemaContext.JsonMergePatch] });
@@ -988,7 +999,7 @@ export class CodeModelBuilder {
988
999
  this.trackSchemaUsage(schema, { serializationFormats: [KnownMediaType.Multipart] });
989
1000
  }
990
1001
  if (op.convenienceApi) {
991
- // Explicit body parameter @body or @bodyRoot would result to the existance of rawHttpOperation.parameters.body.property
1002
+ // Explicit body parameter @body or @bodyRoot would result to the existence of rawHttpOperation.parameters.body.property
992
1003
  // Implicit body parameter would result to rawHttpOperation.parameters.body.property be undefined
993
1004
  // see https://typespec.io/docs/libraries/http/cheat-sheet#data-types
994
1005
  const bodyParameterFlatten = schema instanceof ObjectSchema &&
@@ -1091,7 +1102,11 @@ export class CodeModelBuilder {
1091
1102
  if (opParameter.kind !== "property") {
1092
1103
  // not body property
1093
1104
  // header/query/path, same location and same serializedName
1094
- existParameter = (_a = op.parameters) === null || _a === void 0 ? void 0 : _a.find((it) => { var _a; return ((_a = it.protocol.http) === null || _a === void 0 ? void 0 : _a.in) === opParameter.kind && it.language.default.serializedName === serializedName; });
1105
+ existParameter = (_a = op.parameters) === null || _a === void 0 ? void 0 : _a.find((it) => {
1106
+ var _a;
1107
+ return ((_a = it.protocol.http) === null || _a === void 0 ? void 0 : _a.in) === opParameter.kind &&
1108
+ it.language.default.serializedName === serializedName;
1109
+ });
1095
1110
  }
1096
1111
  request.parameters = (_b = request.parameters) !== null && _b !== void 0 ? _b : [];
1097
1112
  if (existParameter) {
@@ -1105,7 +1120,9 @@ export class CodeModelBuilder {
1105
1120
  else {
1106
1121
  // property from anonymous model
1107
1122
  const existBodyProperty = (_e = schema.properties) === null || _e === void 0 ? void 0 : _e.find((it) => it.serializedName === serializedName);
1108
- if (existBodyProperty && !existBodyProperty.readOnly && !(existBodyProperty.schema instanceof ConstantSchema)) {
1123
+ if (existBodyProperty &&
1124
+ !existBodyProperty.readOnly &&
1125
+ !(existBodyProperty.schema instanceof ConstantSchema)) {
1109
1126
  request.parameters.push(new VirtualParameter(existBodyProperty.language.default.name, existBodyProperty.language.default.description, existBodyProperty.schema, {
1110
1127
  originalParameter: originalParameter,
1111
1128
  targetProperty: existBodyProperty,
@@ -1149,7 +1166,9 @@ export class CodeModelBuilder {
1149
1166
  }
1150
1167
  const bodyType = sdkResponse.type;
1151
1168
  let trackConvenienceApi = Boolean(op.convenienceApi);
1152
- const unknownResponseBody = sdkResponse.contentTypes && sdkResponse.contentTypes.length > 0 && !isKnownContentType(sdkResponse.contentTypes);
1169
+ const unknownResponseBody = sdkResponse.contentTypes &&
1170
+ sdkResponse.contentTypes.length > 0 &&
1171
+ !isKnownContentType(sdkResponse.contentTypes);
1153
1172
  let response;
1154
1173
  if (unknownResponseBody && bodyType && bodyType.kind === "bytes") {
1155
1174
  // binary
@@ -1491,7 +1510,8 @@ export class CodeModelBuilder {
1491
1510
  },
1492
1511
  },
1493
1512
  });
1494
- objectSchema.crossLanguageDefinitionId = type.crossLanguageDefinitionId;
1513
+ objectSchema.crossLanguageDefinitionId =
1514
+ type.crossLanguageDefinitionId;
1495
1515
  this.codeModel.schemas.add(objectSchema);
1496
1516
  // cache this now before we accidentally recurse on this type.
1497
1517
  if (!this.schemaCache.has(type)) {
@@ -1603,6 +1623,11 @@ export class CodeModelBuilder {
1603
1623
  if (prop.multipartOptions.isFilePart) {
1604
1624
  schema = this.processMultipartFormDataFilePropertySchemaFromSdkType(prop);
1605
1625
  }
1626
+ else if (prop.type.kind === "model" &&
1627
+ prop.type.properties.some((it) => it.kind === "body")) {
1628
+ // TODO: this is HttpPart of non-File. TCGC should help handle this.
1629
+ schema = this.processSchemaFromSdkType(prop.type.properties.find((it) => it.kind === "body").type, "");
1630
+ }
1606
1631
  else {
1607
1632
  schema = this.processSchemaFromSdkType(nonNullType, "");
1608
1633
  }
@@ -1674,7 +1699,9 @@ export class CodeModelBuilder {
1674
1699
  case "Scalar": {
1675
1700
  const scalarName = type.name;
1676
1701
  let name = type.name;
1677
- if (scalarName.startsWith("int") || scalarName.startsWith("uint") || scalarName === "safeint") {
1702
+ if (scalarName.startsWith("int") ||
1703
+ scalarName.startsWith("uint") ||
1704
+ scalarName === "safeint") {
1678
1705
  name = scalarName === "safeint" || scalarName.includes("int64") ? "Long" : "Integer";
1679
1706
  }
1680
1707
  else if (scalarName.startsWith("float")) {
@@ -1693,7 +1720,7 @@ export class CodeModelBuilder {
1693
1720
  case "Model":
1694
1721
  if (isArrayModelType(this.program, type)) {
1695
1722
  ++option.depth;
1696
- if (option.depth == 1) {
1723
+ if (option.depth === 1) {
1697
1724
  return this.getUnionVariantName(type.indexer.value, option) + "List";
1698
1725
  }
1699
1726
  else {
@@ -1702,7 +1729,7 @@ export class CodeModelBuilder {
1702
1729
  }
1703
1730
  else if (isRecordModelType(this.program, type)) {
1704
1731
  ++option.depth;
1705
- if (option.depth == 1) {
1732
+ if (option.depth === 1) {
1706
1733
  return this.getUnionVariantName(type.indexer.value, option) + "Map";
1707
1734
  }
1708
1735
  else {
@@ -1728,7 +1755,9 @@ export class CodeModelBuilder {
1728
1755
  var _a, _b, _c, _d;
1729
1756
  const processSchemaFunc = (type) => this.processSchemaFromSdkType(type, "");
1730
1757
  if (property.type.kind === "bytes" || property.type.kind === "model") {
1731
- const namespace = property.type.kind === "model" ? ((_a = getNamespace(property.type.__raw)) !== null && _a !== void 0 ? _a : this.namespace) : this.namespace;
1758
+ const namespace = property.type.kind === "model"
1759
+ ? ((_a = getNamespace(property.type.__raw)) !== null && _a !== void 0 ? _a : this.namespace)
1760
+ : this.namespace;
1732
1761
  return getFileDetailsSchema(property, (_b = getNamespace(property.type.__raw)) !== null && _b !== void 0 ? _b : this.namespace, namespace, this.codeModel.schemas, this.binarySchema, this.stringSchema, processSchemaFunc);
1733
1762
  }
1734
1763
  else if (property.type.kind === "array" &&
@@ -1831,7 +1860,8 @@ export class CodeModelBuilder {
1831
1860
  if (!namespace) {
1832
1861
  return undefined;
1833
1862
  }
1834
- else if (baseJavaNamespace && (namespace === tspNamespace || namespace.startsWith(tspNamespace + "."))) {
1863
+ else if (baseJavaNamespace &&
1864
+ (namespace === tspNamespace || namespace.startsWith(tspNamespace + "."))) {
1835
1865
  return baseJavaNamespace + namespace.slice(tspNamespace.length).toLowerCase();
1836
1866
  }
1837
1867
  else {
@@ -1864,10 +1894,11 @@ export class CodeModelBuilder {
1864
1894
  }
1865
1895
  get anySchema() {
1866
1896
  var _a;
1867
- return (_a = this._anySchema) !== null && _a !== void 0 ? _a : (this._anySchema = this.codeModel.schemas.add(new AnySchema("Anything")));
1897
+ return ((_a = this._anySchema) !== null && _a !== void 0 ? _a : (this._anySchema = this.codeModel.schemas.add(new AnySchema("Anything"))));
1868
1898
  }
1869
1899
  get binarySchema() {
1870
- return this._binarySchema || (this._binarySchema = this.codeModel.schemas.add(new BinarySchema("simple binary")));
1900
+ return (this._binarySchema ||
1901
+ (this._binarySchema = this.codeModel.schemas.add(new BinarySchema("simple binary"))));
1871
1902
  }
1872
1903
  get pollResultSchema() {
1873
1904
  var _a;
@@ -1940,7 +1971,7 @@ export class CodeModelBuilder {
1940
1971
  var _a;
1941
1972
  if (p.readOnly && ((_a = schemaUsage.usage) === null || _a === void 0 ? void 0 : _a.includes(SchemaContext.Input))) {
1942
1973
  const schemaUsageWithoutInput = {
1943
- usage: schemaUsage.usage.filter((it) => it != SchemaContext.Input),
1974
+ usage: schemaUsage.usage.filter((it) => it !== SchemaContext.Input),
1944
1975
  serializationFormats: schemaUsage.serializationFormats,
1945
1976
  };
1946
1977
  innerApplySchemaUsage(p.schema, schemaUsageWithoutInput);