@azure-tools/typespec-java 0.27.6 → 0.27.7

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.
@@ -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,EAOZ,MAAM,EAMN,YAAY,EAKb,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAyBL,OAAO,EAOR,MAAM,6CAA6C,CAAC;AACrD,OAAO,EACL,WAAW,EAKX,OAAO,EACP,IAAI,EAEJ,KAAK,EAQN,MAAM,oBAAoB,CAAC;AAa5B,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AASnD,OAAO,EAAE,cAAc,EAAgD,MAAM,UAAU,CAAC;AAcxF,OAAO,EACL,eAAe,EAShB,MAAM,iBAAiB,CAAC;AAgBzB,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,OAAO,CAAU;IACzB,OAAO,CAAC,eAAe,CAAkB;IACzC,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,iBAAiB,CAAU;IACnC,OAAO,CAAC,mBAAmB,CAAW;IACtC,OAAO,CAAC,UAAU,CAAc;IAChC,OAAO,CAAC,OAAO,CAAiB;IAChC,OAAO,CAAC,SAAS,CAAY;IAC7B,OAAO,CAAC,cAAc,CAA8B;IACpD,OAAO,CAAC,gBAAgB,CAAY;IAEpC,QAAQ,CAAC,WAAW,mCAElB;IACF,QAAQ,CAAC,iBAAiB,sCAA6C;IAGvE,OAAO,CAAC,UAAU,CAAqB;gBAEpB,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,WAAW,CAAC,cAAc,CAAC;IAmD7D,KAAK,IAAI,OAAO,CAAC,SAAS,CAAC;IAoDxC,OAAO,CAAC,qBAAqB;IAoC7B,OAAO,CAAC,WAAW;I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AAC,CAAY;IACzC,OAAO,CAAC,0BAA0B,CAAC,CAAY;IAC/C,OAAO,CAAC,4BAA4B,CAAC,CAAY;IACjD,OAAO,CAAC,uBAAuB,CAAC,CAAY;IAE5C,OAAO,CAAC,sBAAsB;IAiC9B,OAAO,CAAC,gBAAgB;IAIxB,OAAO,CAAC,uBAAuB;IAwB/B,OAAO,CAAC,sBAAsB,CAAC,CAAY;IAE3C,OAAO,CAAC,oBAAoB;IA4F5B,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, PageableContinuationToken, } 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";
@@ -20,7 +20,7 @@ import { createPollOperationDetailsSchema, getFileDetailsSchema } from "./extern
20
20
  import { LIB_NAME, createDiagnostic, reportDiagnostic } from "./lib.js";
21
21
  import { ClientContext } from "./models.js";
22
22
  import { CONTENT_TYPE_KEY, ORIGIN_API_VERSION, SPECIAL_HEADER_NAMES, cloneOperationParameter, getServiceVersion, isKnownContentType, isLroNewPollingStrategy, operationIsJsonMergePatch, operationIsMultipart, operationIsMultipleContentTypes, } from "./operation-utils.js";
23
- import { ProcessingCache, getAccess, getDurationFormat, getNonNullSdkType, getPropertySerializedName, getUnionDescription, getUsage, modelIs, pushDistinct, } from "./type-utils.js";
23
+ import { BYTES_KNOWN_ENCODING, DATETIME_KNOWN_ENCODING, DURATION_KNOWN_ENCODING, ProcessingCache, getAccess, getDurationFormat, getNonNullSdkType, getPropertySerializedName, getUnionDescription, getUsage, modelIs, pushDistinct, } from "./type-utils.js";
24
24
  import { DiagnosticError, getNamespace, isStableApiVersion, pascalCase, removeClientSuffix, stringArrayContainsIgnoreCase, trace, } from "./utils.js";
25
25
  const { isEqual } = pkg;
26
26
  const AZURE_CORE_FOUNDATIONS_ERROR_ID = "Azure.Core.Foundations.Error";
@@ -708,50 +708,132 @@ export class CodeModelBuilder {
708
708
  this.processResponse(codeModelOperation, response.statusCodes, response, lroMetadata.longRunning, true);
709
709
  }
710
710
  // check for paged
711
- this.processRouteForPaged(codeModelOperation, sdkMethod.operation.responses, sdkMethod);
711
+ this.processRouteForPaged(codeModelOperation, sdkMethod);
712
712
  // check for long-running operation
713
713
  this.processRouteForLongRunning(codeModelOperation, lroMetadata);
714
714
  operationGroup.addOperation(codeModelOperation);
715
715
  return codeModelOperation;
716
716
  }
717
- processRouteForPaged(op, responses, sdkMethod) {
718
- var _a, _b;
719
- if (sdkMethod.kind === "paging" || sdkMethod.kind === "lropaging") {
720
- for (const response of responses) {
721
- const bodyType = response.type;
722
- if (bodyType && bodyType.kind === "model") {
723
- let itemSerializedName = undefined;
724
- let nextLinkSerializedName = undefined;
725
- const itemSegments = sdkMethod.response.resultSegments;
726
- const nextLinkSegments = sdkMethod.pagingMetadata.nextLinkSegments;
727
- // TODO: in future the property could be nested, so that the "itemSegments" or "nextLinkSegments" would contain more than 1 element
728
- if (itemSegments) {
729
- // "itemsSegments" should exist for "paging"/"lropaging"
730
- const lastSegment = itemSegments[itemSegments.length - 1];
731
- if (lastSegment.kind === "property") {
732
- itemSerializedName = getPropertySerializedName(lastSegment);
717
+ processRouteForPaged(op, sdkMethod) {
718
+ var _a, _b, _c;
719
+ if (sdkMethod.kind !== "paging" && sdkMethod.kind !== "lropaging") {
720
+ return;
721
+ }
722
+ // TCGC should already verified that there is 1 response, and response body is a model
723
+ const responses = sdkMethod.operation.responses;
724
+ if (responses.length === 0) {
725
+ return;
726
+ }
727
+ const response = responses[0];
728
+ const bodyType = response.type;
729
+ if (!bodyType || bodyType.kind !== "model") {
730
+ return;
731
+ }
732
+ (_a = op.responses) === null || _a === void 0 ? void 0 : _a.forEach((r) => {
733
+ if (r instanceof SchemaResponse) {
734
+ this.trackSchemaUsage(r.schema, { usage: [SchemaContext.Paged] });
735
+ }
736
+ });
737
+ function getLastPropertySegment(segments) {
738
+ if (segments) {
739
+ const lastSegment = segments[segments.length - 1];
740
+ if (lastSegment.kind === "property") {
741
+ return lastSegment;
742
+ }
743
+ }
744
+ return undefined;
745
+ }
746
+ function getLastSegment(segments) {
747
+ if (segments) {
748
+ return segments[segments.length - 1];
749
+ }
750
+ return undefined;
751
+ }
752
+ function getLastSegmentSerializedName(segments) {
753
+ const lastSegment = getLastPropertySegment(segments);
754
+ return lastSegment ? getPropertySerializedName(lastSegment) : undefined;
755
+ }
756
+ // TODO: in future the property could be nested, so that the "itemSegments" or "nextLinkSegments" would contain more than 1 element
757
+ // item/result
758
+ // "itemsSegments" should exist for "paging"/"lropaging"
759
+ const itemSerializedName = getLastSegmentSerializedName(sdkMethod.response.resultSegments);
760
+ // nextLink
761
+ const nextLinkSerializedName = getLastSegmentSerializedName(sdkMethod.pagingMetadata.nextLinkSegments);
762
+ // continuationToken
763
+ let continuationTokenParameter;
764
+ let continuationTokenResponseProperty;
765
+ let continuationTokenResponseHeader;
766
+ if (!this.isBranded()) {
767
+ const continuationTokenParameterSegment = getLastSegment(sdkMethod.pagingMetadata.continuationTokenParameterSegments);
768
+ const continuationTokenResponseSegment = getLastSegment(sdkMethod.pagingMetadata.continuationTokenResponseSegments);
769
+ if (continuationTokenParameterSegment && op.parameters) {
770
+ // for now, continuationToken is either request query or header parameter
771
+ const parameter = getHttpOperationParameter(sdkMethod, continuationTokenParameterSegment);
772
+ if (parameter) {
773
+ for (const param of op.parameters) {
774
+ if (((_b = param.protocol.http) === null || _b === void 0 ? void 0 : _b.in) === parameter.kind) {
775
+ if (parameter.kind === "header" &&
776
+ param.language.default.serializedName.toLowerCase() ===
777
+ parameter.serializedName.toLowerCase()) {
778
+ continuationTokenParameter = param;
779
+ break;
780
+ }
781
+ else if (param.language.default.serializedName === parameter.serializedName) {
782
+ continuationTokenParameter = param;
783
+ break;
784
+ }
733
785
  }
734
786
  }
735
- if (nextLinkSegments) {
736
- const lastSegment = nextLinkSegments[nextLinkSegments.length - 1];
737
- if (lastSegment.kind === "property") {
738
- nextLinkSerializedName = getPropertySerializedName(lastSegment);
787
+ }
788
+ }
789
+ if (continuationTokenResponseSegment && op.responses) {
790
+ if ((continuationTokenResponseSegment === null || continuationTokenResponseSegment === void 0 ? void 0 : continuationTokenResponseSegment.kind) === "responseheader") {
791
+ // continuationToken is response header
792
+ for (const response of op.responses) {
793
+ if (response instanceof SchemaResponse && response.protocol.http) {
794
+ for (const header of response.protocol.http.headers) {
795
+ if (header.header.toLowerCase() ===
796
+ continuationTokenResponseSegment.serializedName.toLowerCase()) {
797
+ continuationTokenResponseHeader = header;
798
+ break;
799
+ }
800
+ }
801
+ }
802
+ if (continuationTokenResponseHeader) {
803
+ break;
739
804
  }
740
805
  }
741
- (_a = op.responses) === null || _a === void 0 ? void 0 : _a.forEach((r) => {
742
- if (r instanceof SchemaResponse) {
743
- this.trackSchemaUsage(r.schema, { usage: [SchemaContext.Paged] });
806
+ }
807
+ else if ((continuationTokenResponseSegment === null || continuationTokenResponseSegment === void 0 ? void 0 : continuationTokenResponseSegment.kind) === "property") {
808
+ // continuationToken is response body property
809
+ // TODO: the property could be nested
810
+ for (const response of op.responses) {
811
+ if (response instanceof SchemaResponse &&
812
+ response.schema instanceof ObjectSchema &&
813
+ response.schema.properties) {
814
+ for (const property of response.schema.properties) {
815
+ if (property.serializedName ===
816
+ getPropertySerializedName(continuationTokenResponseSegment)) {
817
+ continuationTokenResponseProperty = [property];
818
+ break;
819
+ }
820
+ }
744
821
  }
745
- });
746
- op.extensions = (_b = op.extensions) !== null && _b !== void 0 ? _b : {};
747
- op.extensions["x-ms-pageable"] = {
748
- itemName: itemSerializedName,
749
- nextLinkName: nextLinkSerializedName,
750
- };
751
- break;
822
+ if (continuationTokenResponseProperty) {
823
+ break;
824
+ }
825
+ }
752
826
  }
753
827
  }
754
828
  }
829
+ op.extensions = (_c = op.extensions) !== null && _c !== void 0 ? _c : {};
830
+ op.extensions["x-ms-pageable"] = {
831
+ itemName: itemSerializedName,
832
+ nextLinkName: nextLinkSerializedName,
833
+ continuationToken: continuationTokenParameter
834
+ ? new PageableContinuationToken(continuationTokenParameter, continuationTokenResponseProperty, continuationTokenResponseHeader)
835
+ : undefined,
836
+ };
755
837
  }
756
838
  processLroMetadata(op, sdkMethod) {
757
839
  const trackConvenienceApi = Boolean(op.convenienceApi);
@@ -1540,7 +1622,7 @@ export class CodeModelBuilder {
1540
1622
  return this.schemaCache.process(type, nameHint) || fail("Unable to process schema.");
1541
1623
  }
1542
1624
  processSchemaImpl(type, nameHint) {
1543
- var _a;
1625
+ var _a, _b, _c;
1544
1626
  if (isSdkBuiltInKind(type.kind)) {
1545
1627
  return this.processBuiltInType(type, nameHint);
1546
1628
  }
@@ -1559,27 +1641,48 @@ export class CodeModelBuilder {
1559
1641
  case "array":
1560
1642
  return this.processArraySchema(type, nameHint);
1561
1643
  case "duration":
1562
- return this.processDurationSchema(type, nameHint, getDurationFormat(type));
1644
+ if (DURATION_KNOWN_ENCODING.includes(type.encode)) {
1645
+ return this.processDurationSchema(type, nameHint, getDurationFormat(type));
1646
+ }
1647
+ else {
1648
+ reportDiagnostic(this.program, {
1649
+ code: "unknown-encode",
1650
+ format: { encode: type.encode },
1651
+ target: (_a = type.__raw) !== null && _a !== void 0 ? _a : NoTarget,
1652
+ });
1653
+ return this.processBuiltInType(type.wireType, nameHint);
1654
+ }
1563
1655
  case "constant":
1564
1656
  return this.processConstantSchema(type, nameHint);
1565
1657
  case "utcDateTime":
1566
1658
  case "offsetDateTime":
1567
- if (type.encode === "unixTimestamp") {
1568
- return this.processUnixTimeSchema(type, nameHint);
1659
+ if (DATETIME_KNOWN_ENCODING.includes(type.encode)) {
1660
+ if (type.encode === "unixTimestamp") {
1661
+ return this.processUnixTimeSchema(type, nameHint);
1662
+ }
1663
+ else {
1664
+ return this.processDateTimeSchema(type, nameHint, type.encode === "rfc7231");
1665
+ }
1569
1666
  }
1570
1667
  else {
1571
- return this.processDateTimeSchema(type, nameHint, type.encode === "rfc7231");
1668
+ reportDiagnostic(this.program, {
1669
+ code: "unknown-encode",
1670
+ format: { encode: type.encode },
1671
+ target: (_b = type.__raw) !== null && _b !== void 0 ? _b : NoTarget,
1672
+ });
1673
+ return this.processBuiltInType(type.wireType, nameHint);
1572
1674
  }
1573
1675
  }
1574
1676
  }
1575
1677
  const diagnostic = createDiagnostic({
1576
1678
  code: "unrecognized-type",
1577
1679
  format: { typeKind: type.kind },
1578
- target: (_a = type.__raw) !== null && _a !== void 0 ? _a : NoTarget,
1680
+ target: (_c = type.__raw) !== null && _c !== void 0 ? _c : NoTarget,
1579
1681
  });
1580
1682
  throw new DiagnosticError(diagnostic);
1581
1683
  }
1582
1684
  processBuiltInType(type, nameHint) {
1685
+ var _a;
1583
1686
  nameHint = nameHint || type.kind;
1584
1687
  if (isSdkIntKind(type.kind)) {
1585
1688
  const integerSize = type.kind === "safeint" || type.kind.includes("int64") ? 64 : 32;
@@ -1599,7 +1702,17 @@ export class CodeModelBuilder {
1599
1702
  case "decimal128":
1600
1703
  return this.processDecimalSchema(type, nameHint);
1601
1704
  case "bytes":
1602
- return this.processByteArraySchema(type, nameHint);
1705
+ if (!type.encode || BYTES_KNOWN_ENCODING.includes(type.encode)) {
1706
+ return this.processByteArraySchema(type, nameHint);
1707
+ }
1708
+ else {
1709
+ reportDiagnostic(this.program, {
1710
+ code: "unknown-encode",
1711
+ format: { encode: type.encode },
1712
+ target: (_a = type.__raw) !== null && _a !== void 0 ? _a : NoTarget,
1713
+ });
1714
+ return this.processStringSchema(type, nameHint);
1715
+ }
1603
1716
  case "boolean":
1604
1717
  return this.processBooleanSchema(type, nameHint);
1605
1718
  case "plainTime":
@@ -2143,7 +2256,7 @@ export class CodeModelBuilder {
2143
2256
  // hopefully it is the root namespace of the SDK
2144
2257
  let baseJavaNamespace = undefined;
2145
2258
  this.sdkContext.sdkPackage.clients
2146
- .map((it) => it.clientNamespace)
2259
+ .map((it) => it.namespace)
2147
2260
  .forEach((it) => {
2148
2261
  if (baseJavaNamespace === undefined || baseJavaNamespace.length > it.length) {
2149
2262
  baseJavaNamespace = it;
@@ -2157,7 +2270,7 @@ export class CodeModelBuilder {
2157
2270
  }
2158
2271
  getJavaNamespace(type = undefined) {
2159
2272
  // clientNamespace from TCGC
2160
- const clientNamespace = type === null || type === void 0 ? void 0 : type.clientNamespace;
2273
+ const clientNamespace = type === null || type === void 0 ? void 0 : type.namespace;
2161
2274
  if (type) {
2162
2275
  const crossLanguageDefinitionId = type.crossLanguageDefinitionId;
2163
2276
  if (this.isBranded()) {