@azure-tools/typespec-rust 0.39.0 → 0.40.0

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.
@@ -183,7 +183,7 @@ export class Adapter {
183
183
  needsCoreAndSerde = true;
184
184
  }
185
185
  for (const sdkEnum of this.ctx.sdkPackage.enums) {
186
- if ((sdkEnum.usage & tcgc.UsageFlags.ApiVersionEnum) === tcgc.UsageFlags.ApiVersionEnum) {
186
+ if ((sdkEnum.usage & tcgc.UsageFlags.ApiVersionEnum) !== 0) {
187
187
  // we skip generating the enums for API
188
188
  // versions as we expose it as a String
189
189
  continue;
@@ -401,12 +401,11 @@ export class Adapter {
401
401
  stack = new Array();
402
402
  }
403
403
  let modelFlags = rust.ModelFlags.Unspecified;
404
- if ((model.usage & tcgc.UsageFlags.Input) === tcgc.UsageFlags.Input) {
404
+ if ((model.usage & tcgc.UsageFlags.Input) !== 0) {
405
405
  modelFlags |= rust.ModelFlags.Input;
406
406
  }
407
407
  // include error and LRO polling types as output types
408
- if ((model.usage & tcgc.UsageFlags.Output) === tcgc.UsageFlags.Output ||
409
- (model.usage & tcgc.UsageFlags.LroPolling) === tcgc.UsageFlags.LroPolling) {
408
+ if ((model.usage & tcgc.UsageFlags.Output) !== 0 || (model.usage & tcgc.UsageFlags.LroPolling) !== 0) {
410
409
  modelFlags |= rust.ModelFlags.Output;
411
410
  }
412
411
  rustModel = new rust.Model(modelName, model.access === 'internal' ? 'pubCrate' : 'pub', modelFlags, this.adaptNamespace(model.namespace));
@@ -1328,7 +1327,7 @@ export class Adapter {
1328
1327
  * @returns a Rust client
1329
1328
  */
1330
1329
  recursiveAdaptClient(client, parent) {
1331
- var _a, _b, _c, _d, _e, _f, _g;
1330
+ var _a, _b, _c, _d, _e, _f, _g, _h;
1332
1331
  let clientName = client.name;
1333
1332
  // NOTE: if the client has the @clientName decorator applied then use that verbatim
1334
1333
  if (parent && !hasClientNameDecorator(client.decorators)) {
@@ -1355,6 +1354,12 @@ export class Adapter {
1355
1354
  rustClient.docs = this.adaptDocs(client.summary, client.doc);
1356
1355
  rustClient.parent = parent;
1357
1356
  rustClient.fields.push(new rust.StructField('pipeline', 'pubCrate', new rust.ExternalType(this.crate, 'Pipeline', 'azure_core::http')));
1357
+ // check if omitEndpointMethod was set to true
1358
+ const omitEndpointMethod = (_a = client.decorators.find(d => d.name === 'Azure.ClientGenerator.Core.@clientOption'
1359
+ && d.arguments['name'] === 'omitEndpointMethod')) === null || _a === void 0 ? void 0 : _a.arguments['value'];
1360
+ if (omitEndpointMethod === true) {
1361
+ rustClient.omitEndpointMethod = omitEndpointMethod;
1362
+ }
1358
1363
  // InitializedByFlags.CustomizeCode means the client is instantiable
1359
1364
  // but the constructor is to be omitted (i.e. hand-written).
1360
1365
  if (client.clientInitialization.initializedBy === tcgc.InitializedByFlags.CustomizeCode || client.clientInitialization.initializedBy & tcgc.InitializedByFlags.Individually) {
@@ -1461,7 +1466,10 @@ export class Adapter {
1461
1466
  const endpointName = hasClientNameDecorator(templateArg.decorators) ? utils.snakeCaseName(templateArg.name) : 'endpoint';
1462
1467
  const adaptedParam = new rust.ClientEndpointParameter(endpointName);
1463
1468
  adaptedParam.docs = this.adaptDocs(param.summary, param.doc);
1464
- ctorParams.push(adaptedParam);
1469
+ // for ARM, the endpoint is derived from cloud config at runtime; don't expose it as a ctor param
1470
+ if (this.crate.type !== 'azure-arm') {
1471
+ ctorParams.push(adaptedParam);
1472
+ }
1465
1473
  const endpointField = new rust.StructField(endpointName, 'pubCrate', new rust.Url(this.crate));
1466
1474
  rustClient.endpoint = endpointField;
1467
1475
  rustClient.fields.push(endpointField);
@@ -1480,9 +1488,9 @@ export class Adapter {
1480
1488
  }
1481
1489
  const clientParam = this.adaptClientParameter(templateArg, rustClient.constructable);
1482
1490
  if (clientParam.kind !== 'clientSupplementalEndpoint') {
1483
- throw new AdapterError('InternalError', `unexpected client parameter kind ${clientParam.kind}`, (_a = templateArg.__raw) === null || _a === void 0 ? void 0 : _a.node);
1491
+ throw new AdapterError('InternalError', `unexpected client parameter kind ${clientParam.kind}`, (_b = templateArg.__raw) === null || _b === void 0 ? void 0 : _b.node);
1484
1492
  }
1485
- (_b = rustClient.constructable.endpoint) === null || _b === void 0 ? void 0 : _b.parameters.push(clientParam);
1493
+ (_c = rustClient.constructable.endpoint) === null || _c === void 0 ? void 0 : _c.parameters.push(clientParam);
1486
1494
  ctorParams.push(clientParam);
1487
1495
  }
1488
1496
  break;
@@ -1496,7 +1504,7 @@ export class Adapter {
1496
1504
  continue;
1497
1505
  }
1498
1506
  else {
1499
- throw new AdapterError('UnsupportedTsp', 'found optional apiVersion parameter with no default value', (_c = param.__raw) === null || _c === void 0 ? void 0 : _c.node);
1507
+ throw new AdapterError('UnsupportedTsp', 'found optional apiVersion parameter with no default value', (_d = param.__raw) === null || _d === void 0 ? void 0 : _d.node);
1500
1508
  }
1501
1509
  }
1502
1510
  const clientParam = this.adaptClientParameter(param, rustClient.constructable);
@@ -1506,7 +1514,7 @@ export class Adapter {
1506
1514
  }
1507
1515
  }
1508
1516
  }
1509
- if (authType === AuthTypes.Default || (authType & AuthTypes.NoAuth) === AuthTypes.NoAuth) {
1517
+ if (authType === AuthTypes.Default || (authType & AuthTypes.NoAuth) !== 0) {
1510
1518
  const ctorWithNoCredential = new rust.Constructor('with_no_credential');
1511
1519
  ctorWithNoCredential.docs.summary = `Creates a new ${rustClient.name} requiring no authentication.`;
1512
1520
  rustClient.constructable.constructors.push(ctorWithNoCredential);
@@ -1549,7 +1557,7 @@ export class Adapter {
1549
1557
  cur = cur.parent;
1550
1558
  }
1551
1559
  if (!constructable || !cur) {
1552
- throw new AdapterError('InternalError', `didn't find constructable client for apiVersion in client ${rustClient.name}`, (_d = prop.__raw) === null || _d === void 0 ? void 0 : _d.node);
1560
+ throw new AdapterError('InternalError', `didn't find constructable client for apiVersion in client ${rustClient.name}`, (_e = prop.__raw) === null || _e === void 0 ? void 0 : _e.node);
1553
1561
  }
1554
1562
  rustClient.fields.push(new rust.StructField(utils.snakeCaseName(prop.name), 'pubCrate', this.getStringType()));
1555
1563
  // we use the client name as a prefix to disambiguate the params in the parent
@@ -1569,7 +1577,7 @@ export class Adapter {
1569
1577
  else {
1570
1578
  throw new AdapterError('InternalError', `uninstantiatable client ${client.name} has no parent`);
1571
1579
  }
1572
- for (const child of (_e = client.children) !== null && _e !== void 0 ? _e : []) {
1580
+ for (const child of (_f = client.children) !== null && _f !== void 0 ? _f : []) {
1573
1581
  const subClient = this.recursiveAdaptClient(child, rustClient);
1574
1582
  this.adaptClientAccessor(client, child, rustClient, subClient);
1575
1583
  }
@@ -1581,7 +1589,7 @@ export class Adapter {
1581
1589
  code: 'LroPagingNotSupported',
1582
1590
  severity: 'warning',
1583
1591
  message: `skip emitting Paging LRO ${method.name}`,
1584
- target: (_g = (_f = method.__raw) === null || _f === void 0 ? void 0 : _f.node) !== null && _g !== void 0 ? _g : tsp.NoTarget,
1592
+ target: (_h = (_g = method.__raw) === null || _g === void 0 ? void 0 : _g.node) !== null && _h !== void 0 ? _h : tsp.NoTarget,
1585
1593
  });
1586
1594
  continue;
1587
1595
  }
@@ -1604,11 +1612,14 @@ export class Adapter {
1604
1612
  throw new AdapterError('InternalError', `no flows defined for credential type ${cred.type}`, cred.model);
1605
1613
  }
1606
1614
  const scopes = new Array();
1607
- for (const scope of cred.flows[0].scopes) {
1608
- scopes.push(scope.value);
1609
- }
1610
- if (scopes.length === 0) {
1611
- throw new AdapterError('InternalError', 'scopes must contain at least one entry', cred.model);
1615
+ // for ARM, scopes are derived from cloud config at runtime; ignore TypeSpec-defined scopes
1616
+ if (this.crate.type !== 'azure-arm') {
1617
+ for (const scope of cred.flows[0].scopes) {
1618
+ scopes.push(scope.value);
1619
+ }
1620
+ if (scopes.length === 0) {
1621
+ throw new AdapterError('InternalError', 'scopes must contain at least one entry', cred.model);
1622
+ }
1612
1623
  }
1613
1624
  const ctorTokenCredential = new rust.Constructor('new');
1614
1625
  const tokenCredParam = new rust.ClientCredentialParameter('credential', new rust.Arc(new rust.TokenCredential(this.crate, scopes)));
@@ -1694,23 +1705,37 @@ export class Adapter {
1694
1705
  * @param rustClient the client to which the method belongs
1695
1706
  */
1696
1707
  adaptMethod(method, rustClient) {
1697
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w;
1708
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y;
1698
1709
  let srcMethodName = method.name;
1699
- if (method.kind === 'paging' && !srcMethodName.match(/^list/i)) {
1700
- const chunks = utils.deconstruct(srcMethodName);
1701
- if (chunks[0] === 'get') {
1702
- chunks[0] = 'list';
1710
+ // NOTE: if the method has the @clientName decorator applied then skip fixing up the name
1711
+ if (!hasClientNameDecorator(method.decorators)) {
1712
+ if (method.kind === 'paging' && !srcMethodName.match(/^list/i)) {
1713
+ const chunks = utils.deconstruct(srcMethodName);
1714
+ if (chunks[0] === 'get') {
1715
+ chunks[0] = 'list';
1716
+ }
1717
+ else {
1718
+ chunks.unshift('list');
1719
+ }
1720
+ srcMethodName = utils.camelCase(chunks);
1721
+ this.ctx.program.reportDiagnostic({
1722
+ code: 'PagingMethodRename',
1723
+ severity: 'warning',
1724
+ message: `renamed paging method from ${method.name} to ${srcMethodName}`,
1725
+ target: (_b = (_a = method.__raw) === null || _a === void 0 ? void 0 : _a.node) !== null && _b !== void 0 ? _b : tsp.NoTarget,
1726
+ });
1727
+ }
1728
+ else if ((method.kind === 'lro' || method.kind === 'lropaging') && !srcMethodName.match(/^begin/i)) {
1729
+ const chunks = utils.deconstruct(srcMethodName);
1730
+ chunks.unshift('begin');
1731
+ srcMethodName = utils.camelCase(chunks);
1732
+ this.ctx.program.reportDiagnostic({
1733
+ code: 'PollingMethodRename',
1734
+ severity: 'warning',
1735
+ message: `renamed polling method from ${method.name} to ${srcMethodName}`,
1736
+ target: (_d = (_c = method.__raw) === null || _c === void 0 ? void 0 : _c.node) !== null && _d !== void 0 ? _d : tsp.NoTarget,
1737
+ });
1703
1738
  }
1704
- else {
1705
- chunks.unshift('list');
1706
- }
1707
- srcMethodName = utils.camelCase(chunks);
1708
- this.ctx.program.reportDiagnostic({
1709
- code: 'PagingMethodRename',
1710
- severity: 'warning',
1711
- message: `renamed paging method from ${method.name} to ${srcMethodName}`,
1712
- target: (_b = (_a = method.__raw) === null || _a === void 0 ? void 0 : _a.node) !== null && _b !== void 0 ? _b : tsp.NoTarget,
1713
- });
1714
1739
  }
1715
1740
  const languageIndependentName = method.crossLanguageDefinitionId;
1716
1741
  const methodName = naming.getEscapedReservedName(utils.snakeCaseName(srcMethodName), 'fn');
@@ -1719,7 +1744,7 @@ export class Adapter {
1719
1744
  // if the method was renamed then ensure it doesn't collide
1720
1745
  for (const existingMethod of rustClient.methods) {
1721
1746
  if (existingMethod.name === methodName) {
1722
- throw new AdapterError('NameCollision', `renamed method ${srcMethodName} collides with an existing method`, (_c = method.__raw) === null || _c === void 0 ? void 0 : _c.node);
1747
+ throw new AdapterError('NameCollision', `renamed method ${srcMethodName} collides with an existing method`, (_e = method.__raw) === null || _e === void 0 ? void 0 : _e.node);
1723
1748
  }
1724
1749
  }
1725
1750
  }
@@ -1773,20 +1798,20 @@ export class Adapter {
1773
1798
  lroFinalResultStrategy = new rust.LroFinalResultStrategyHeader('operation-location');
1774
1799
  break;
1775
1800
  case FinalStateValue.customLink:
1776
- if (((_d = method.lroMetadata.statusMonitorStep) === null || _d === void 0 ? void 0 : _d.kind) === "nextOperationLink") {
1801
+ if (((_f = method.lroMetadata.statusMonitorStep) === null || _f === void 0 ? void 0 : _f.kind) === "nextOperationLink") {
1777
1802
  const customHeaderName = method.lroMetadata.statusMonitorStep.target.property.name;
1778
1803
  if (customHeaderName.trim() === '') {
1779
- throw new AdapterError('UnsupportedTsp', `lroMetadata.finalStateVia === customLink && customHeaderName === "${customHeaderName}"`, (_e = method.__raw) === null || _e === void 0 ? void 0 : _e.node);
1804
+ throw new AdapterError('UnsupportedTsp', `lroMetadata.finalStateVia === customLink && customHeaderName === "${customHeaderName}"`, (_g = method.__raw) === null || _g === void 0 ? void 0 : _g.node);
1780
1805
  }
1781
1806
  lroFinalResultStrategy = new rust.LroFinalResultStrategyHeader(customHeaderName);
1782
1807
  }
1783
1808
  else {
1784
- throw new AdapterError('UnsupportedTsp', `lroMetadata.finalStateVia === customLink && lroMetadata.statusMonitorStep?.kind === "${(_f = method.lroMetadata.statusMonitorStep) === null || _f === void 0 ? void 0 : _f.kind}"`, (_g = method.__raw) === null || _g === void 0 ? void 0 : _g.node);
1809
+ throw new AdapterError('UnsupportedTsp', `lroMetadata.finalStateVia === customLink && lroMetadata.statusMonitorStep?.kind === "${(_h = method.lroMetadata.statusMonitorStep) === null || _h === void 0 ? void 0 : _h.kind}"`, (_j = method.__raw) === null || _j === void 0 ? void 0 : _j.node);
1785
1810
  }
1786
1811
  break;
1787
1812
  default:
1788
1813
  /* eslint-disable-next-line @typescript-eslint/restrict-template-expressions */
1789
- throw new AdapterError('UnsupportedTsp', `lroMetadata.finalStateVia ${method.lroMetadata.finalStateVia} NYI`, (_h = method.__raw) === null || _h === void 0 ? void 0 : _h.node);
1814
+ throw new AdapterError('UnsupportedTsp', `lroMetadata.finalStateVia ${method.lroMetadata.finalStateVia} NYI`, (_k = method.__raw) === null || _k === void 0 ? void 0 : _k.node);
1790
1815
  }
1791
1816
  lroFinalResultStrategy.propertyName = method.lroMetadata.finalResultPath;
1792
1817
  }
@@ -1794,7 +1819,7 @@ export class Adapter {
1794
1819
  }
1795
1820
  break;
1796
1821
  default:
1797
- throw new AdapterError('UnsupportedTsp', `method kind ${method.kind} NYI`, (_j = method.__raw) === null || _j === void 0 ? void 0 : _j.node);
1822
+ throw new AdapterError('UnsupportedTsp', `method kind ${method.kind} NYI`, (_l = method.__raw) === null || _l === void 0 ? void 0 : _l.node);
1798
1823
  }
1799
1824
  rustMethod.docs = this.adaptDocs(method.summary, method.doc);
1800
1825
  rustClient.methods.push(rustMethod);
@@ -1841,7 +1866,7 @@ export class Adapter {
1841
1866
  else {
1842
1867
  fieldType = this.getOptionType(adaptedParam.type);
1843
1868
  }
1844
- const optionsField = new rust.StructField(adaptedParam.name, pub, fieldType);
1869
+ const optionsField = new rust.StructField(adaptedParam.name, adaptAccessFlags(methodParam.access), fieldType);
1845
1870
  optionsField.docs = adaptedParam.docs;
1846
1871
  rustMethod.options.type.type.fields.push(optionsField);
1847
1872
  }
@@ -1915,7 +1940,7 @@ export class Adapter {
1915
1940
  if (!fieldOptional) {
1916
1941
  if (!paramGroup) {
1917
1942
  if (param.type.kind !== 'model') {
1918
- throw new AdapterError('InternalError', `expected model type for parameter group but got ${param.type.kind}`, (_k = param.__raw) === null || _k === void 0 ? void 0 : _k.node);
1943
+ throw new AdapterError('InternalError', `expected model type for parameter group but got ${param.type.kind}`, (_m = param.__raw) === null || _m === void 0 ? void 0 : _m.node);
1919
1944
  }
1920
1945
  const groupName = utils.capitalize(param.type.name).replace(/\W/g, '');
1921
1946
  const paramName = naming.getEscapedReservedName(utils.snakeCaseName(param.name), 'param', reservedParams);
@@ -1960,7 +1985,7 @@ export class Adapter {
1960
1985
  }
1961
1986
  }
1962
1987
  else {
1963
- throw new AdapterError('InternalError', `didn't find operation parameter for method ${method.name} parameter ${param.name}`, (_l = param.__raw) === null || _l === void 0 ? void 0 : _l.node);
1988
+ throw new AdapterError('InternalError', `didn't find operation parameter for method ${method.name} parameter ${param.name}`, (_o = param.__raw) === null || _o === void 0 ? void 0 : _o.node);
1964
1989
  }
1965
1990
  }
1966
1991
  // client params aren't included in method.parameters so
@@ -2043,16 +2068,16 @@ export class Adapter {
2043
2068
  const responseFormat = getResponseFormat();
2044
2069
  if (method.kind === 'paging') {
2045
2070
  if (responseFormat !== 'JsonFormat' && responseFormat !== 'XmlFormat') {
2046
- throw new AdapterError('InternalError', `paged method ${method.name} unexpected response format ${responseFormat}`, (_m = method.__raw) === null || _m === void 0 ? void 0 : _m.node);
2071
+ throw new AdapterError('InternalError', `paged method ${method.name} unexpected response format ${responseFormat}`, (_p = method.__raw) === null || _p === void 0 ? void 0 : _p.node);
2047
2072
  }
2048
2073
  // for paged methods, tcgc models method.response.type as an Array<T>.
2049
2074
  // however, we want the synthesized paged response envelope type instead.
2050
2075
  const synthesizedType = method.operation.responses[0].type;
2051
2076
  if (!synthesizedType) {
2052
- throw new AdapterError('InternalError', `paged method ${method.name} has no synthesized response type`, (_o = method.__raw) === null || _o === void 0 ? void 0 : _o.node);
2077
+ throw new AdapterError('InternalError', `paged method ${method.name} has no synthesized response type`, (_q = method.__raw) === null || _q === void 0 ? void 0 : _q.node);
2053
2078
  }
2054
2079
  else if (synthesizedType.kind !== 'model') {
2055
- throw new AdapterError('UnsupportedTsp', `paged method ${method.name} synthesized response type has unexpected kind ${synthesizedType.kind}`, (_p = method.__raw) === null || _p === void 0 ? void 0 : _p.node);
2080
+ throw new AdapterError('UnsupportedTsp', `paged method ${method.name} synthesized response type has unexpected kind ${synthesizedType.kind}`, (_r = method.__raw) === null || _r === void 0 ? void 0 : _r.node);
2056
2081
  }
2057
2082
  const synthesizedModel = this.getModel(synthesizedType, new Array());
2058
2083
  const modelNs = this.adaptNamespace(synthesizedType.namespace);
@@ -2061,7 +2086,7 @@ export class Adapter {
2061
2086
  }
2062
2087
  // for the pager response type, remove the Option<T> around the Vec<T> for the page items
2063
2088
  if (!method.pagingMetadata.pageItemsSegments) {
2064
- throw new AdapterError('InternalError', `paged method ${method.name} has no pageItemsSegments`, (_q = method.__raw) === null || _q === void 0 ? void 0 : _q.node);
2089
+ throw new AdapterError('InternalError', `paged method ${method.name} has no pageItemsSegments`, (_s = method.__raw) === null || _s === void 0 ? void 0 : _s.node);
2065
2090
  }
2066
2091
  // unwrap all of the segments for the paged response
2067
2092
  let unwrappedCount = 0;
@@ -2072,13 +2097,13 @@ export class Adapter {
2072
2097
  switch (responseFormat) {
2073
2098
  case 'JsonFormat':
2074
2099
  if (segment.kind !== 'property' || !segment.serializationOptions.json) {
2075
- throw new AdapterError('InternalError', `paged method ${method.name} is missing JSON serialization data`, (_r = method.__raw) === null || _r === void 0 ? void 0 : _r.node);
2100
+ throw new AdapterError('InternalError', `paged method ${method.name} is missing JSON serialization data`, (_t = method.__raw) === null || _t === void 0 ? void 0 : _t.node);
2076
2101
  }
2077
2102
  serde = segment.serializationOptions.json.name;
2078
2103
  break;
2079
2104
  case 'XmlFormat':
2080
2105
  if (segment.kind !== 'property' || !segment.serializationOptions.xml) {
2081
- throw new AdapterError('InternalError', `paged method ${method.name} is missing XML serialization data`, (_s = method.__raw) === null || _s === void 0 ? void 0 : _s.node);
2106
+ throw new AdapterError('InternalError', `paged method ${method.name} is missing XML serialization data`, (_u = method.__raw) === null || _u === void 0 ? void 0 : _u.node);
2082
2107
  }
2083
2108
  serde = segment.serializationOptions.xml.name;
2084
2109
  break;
@@ -2091,7 +2116,7 @@ export class Adapter {
2091
2116
  if (field.serde === serde) {
2092
2117
  // check if this has already been unwrapped (e.g. type is shared across operations)
2093
2118
  if (field.type.kind === 'option') {
2094
- field.type = (field.type).type;
2119
+ field.type = field.type.type;
2095
2120
  field.flags |= rust.ModelFieldFlags.PageItems;
2096
2121
  }
2097
2122
  // move to the next segment
@@ -2104,7 +2129,7 @@ export class Adapter {
2104
2129
  }
2105
2130
  }
2106
2131
  if (unwrappedCount !== method.pagingMetadata.pageItemsSegments.length) {
2107
- throw new AdapterError('InternalError', `failed to unwrap paged items for method ${method.name}`, (_t = method.__raw) === null || _t === void 0 ? void 0 : _t.node);
2132
+ throw new AdapterError('InternalError', `failed to unwrap paged items for method ${method.name}`, (_v = method.__raw) === null || _v === void 0 ? void 0 : _v.node);
2108
2133
  }
2109
2134
  this.crate.addDependency(new rust.CrateDependency('async-trait'));
2110
2135
  // default to nextLink. will update it as required when we have that info
@@ -2137,7 +2162,7 @@ export class Adapter {
2137
2162
  const statusModel = this.getModel(method.lroMetadata.pollingInfo.responseModel, undefined, `${rustClient.name}${utils.pascalCase(rustMethod.name, false)}OperationStatus`);
2138
2163
  const statusType = this.typeToWireType(statusModel);
2139
2164
  if (statusType.kind !== 'model') {
2140
- throw new AdapterError('InternalError', `status type for an LRO method '${method.name}' is not a model`, (_u = method.__raw) === null || _u === void 0 ? void 0 : _u.node);
2165
+ throw new AdapterError('InternalError', `status type for an LRO method '${method.name}' is not a model`, (_w = method.__raw) === null || _w === void 0 ? void 0 : _w.node);
2141
2166
  }
2142
2167
  // the adapted type likely comes from core which means
2143
2168
  // it will be in the root namespace. since we emit these
@@ -2194,10 +2219,10 @@ export class Adapter {
2194
2219
  // can't do this until the method has been completely adapted
2195
2220
  const pageableMethod = rustMethod;
2196
2221
  pageableMethod.strategy = this.adaptPageableMethodStrategy(method, paramsMap, responseHeadersMap);
2197
- if (((_v = pageableMethod.strategy) === null || _v === void 0 ? void 0 : _v.kind) === 'nextLink') {
2222
+ if (((_x = pageableMethod.strategy) === null || _x === void 0 ? void 0 : _x.kind) === 'nextLink') {
2198
2223
  pageableMethod.strategy.reinjectedParams = this.adaptPageableMethodReinjectionParams(method, paramsMap);
2199
2224
  }
2200
- else if (((_w = pageableMethod.strategy) === null || _w === void 0 ? void 0 : _w.kind) === 'continuationToken') {
2225
+ else if (((_y = pageableMethod.strategy) === null || _y === void 0 ? void 0 : _y.kind) === 'continuationToken') {
2201
2226
  // set the continuation type to token on the Pager and the PagerOptions field in the method options
2202
2227
  pageableMethod.returns.type.continuation = 'token';
2203
2228
  for (const field of pageableMethod.options.type.type.fields) {
@@ -2546,6 +2571,7 @@ export class Adapter {
2546
2571
  case 'path':
2547
2572
  {
2548
2573
  paramType = this.typeToWireType(paramType);
2574
+ // eslint-disable-next-line no-useless-assignment
2549
2575
  let style = 'simple';
2550
2576
  const tspStyleString = opParam.style;
2551
2577
  if (!['simple', 'path', 'label', 'matrix'].includes(tspStyleString)) {
@@ -2570,11 +2596,15 @@ export class Adapter {
2570
2596
  throw new AdapterError('InternalError', `unexpected kind ${paramType.kind} for scalar path ${opParam.serializedName}`, (_g = opParam.__raw) === null || _g === void 0 ? void 0 : _g.node);
2571
2597
  }
2572
2598
  adaptedParam = new rust.PathScalarParameter(paramName, opParam.serializedName, paramLoc, paramOptional, paramType, opParam.allowReserved, style);
2573
- const allowEmpty = ((_h = opParam.decorators.find(d => d.name === 'Azure.ClientGenerator.Core.@clientOption'
2574
- && d.arguments['name'] === 'allowEmpty'
2575
- && d.arguments['scope'] === 'rust')) === null || _h === void 0 ? void 0 : _h.arguments['value']) === true;
2576
- if (allowEmpty) {
2577
- adaptedParam.minLength = 0;
2599
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
2600
+ const minLength = (_h = methodParam === null || methodParam === void 0 ? void 0 : methodParam.decorators.find(d => d.name === 'Azure.ClientGenerator.Core.@clientOption'
2601
+ && d.arguments['name'] === 'minLength'
2602
+ && d.arguments['scope'] === 'rust')) === null || _h === void 0 ? void 0 : _h.arguments['value'];
2603
+ if (minLength !== undefined) {
2604
+ if (minLength !== 0) {
2605
+ throw new AdapterError('UnsupportedTsp', `minLength decorator with a non-zero value (${minLength}).)`);
2606
+ }
2607
+ adaptedParam.minLength = minLength;
2578
2608
  }
2579
2609
  }
2580
2610
  }
@@ -2816,6 +2846,8 @@ function recursiveKeyName(root, type) {
2816
2846
  return `${root}-${type.kind}-${type.name}`;
2817
2847
  case 'enumValue':
2818
2848
  return `${root}-${type.type.name}-${type.name}`;
2849
+ case 'external':
2850
+ return `${root}-${type.path}::${type.name}`;
2819
2851
  case 'hashmap':
2820
2852
  return recursiveKeyName(`${root}-${type.kind}`, type.type);
2821
2853
  case 'offsetDateTime':
@@ -2937,7 +2969,8 @@ export function formatVisibility(visibility) {
2937
2969
  combined |= v;
2938
2970
  }
2939
2971
  // if all lifecycle flags are set, there's no restriction
2940
- if ((combined & http.Visibility.All) === http.Visibility.All) {
2972
+ const allFlagsSet = http.Visibility.All;
2973
+ if ((combined & http.Visibility.All) === allFlagsSet) {
2941
2974
  return undefined;
2942
2975
  }
2943
2976
  // flags are checked in sorted order: Create, Delete, Query, Read, Update