@looker/sdk-codegen 21.6.0 → 21.7.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.
@@ -397,7 +397,6 @@ export interface IApiModel extends IModel {
397
397
  }
398
398
  export declare class ApiModel implements ISymbolTable, IApiModel {
399
399
  readonly spec: OAS.OpenAPIObject;
400
- private requestTypes;
401
400
  private enumTypes;
402
401
  private refs;
403
402
  methods: MethodList;
@@ -417,13 +416,14 @@ export declare class ApiModel implements ISymbolTable, IApiModel {
417
416
  jsonPath(path: string | string[], item?: any, splitter?: string): any;
418
417
  private schemaHasEnums;
419
418
  resolveType(schema: string | OAS.SchemaObject | OAS.ReferenceObject, style?: string, typeName?: string, methodName?: string): IType;
420
- makeRequestType(hash: string, method: IMethod): RequestType;
419
+ private requestTypeName;
420
+ makeRequestType(method: IMethod): RequestType;
421
421
  registerEnum(type: IType, methodName?: string): IType;
422
422
  private _getRequestType;
423
423
  getRequestType(method: IMethod): IType | undefined;
424
424
  getEnumList(): TypeList;
425
- makeWriteableType(hash: string, type: IType): WriteType;
426
- mayGetWriteableType(type: IType): IType | WriteType | undefined;
425
+ makeWriteableType(type: IType): WriteType;
426
+ mayGetWriteableType(type: IType): WriteType | undefined;
427
427
  loadDynamicTypes(): void;
428
428
  sortList<T>(list: KeyedCollection<T>): KeyedCollection<T>;
429
429
  sortLists(): void;
package/lib/sdkModels.js CHANGED
@@ -1371,8 +1371,6 @@ class ApiModel {
1371
1371
  constructor(spec) {
1372
1372
  this.spec = spec;
1373
1373
 
1374
- _defineProperty(this, "requestTypes", {});
1375
-
1376
1374
  _defineProperty(this, "enumTypes", {});
1377
1375
 
1378
1376
  _defineProperty(this, "refs", {});
@@ -1603,11 +1601,14 @@ class ApiModel {
1603
1601
  throw new Error("Schema ".concat(typeof schema === 'string' ? schema : JSON.stringify(schema), " must have a ref or a type"));
1604
1602
  }
1605
1603
 
1606
- makeRequestType(hash, method) {
1607
- var name = "".concat(strRequest).concat(camelCase('_' + method.name));
1604
+ requestTypeName(method) {
1605
+ return "".concat(strRequest).concat(camelCase('_' + method.name));
1606
+ }
1607
+
1608
+ makeRequestType(method) {
1609
+ var name = this.requestTypeName(method);
1608
1610
  var request = new RequestType(this, name, method.allParams, "Dynamically generated request type for ".concat(method.name));
1609
1611
  this.types[name] = request;
1610
- this.requestTypes[hash] = request;
1611
1612
  method.addType(this, request);
1612
1613
  return request;
1613
1614
  }
@@ -1640,11 +1641,8 @@ class ApiModel {
1640
1641
 
1641
1642
  _getRequestType(method) {
1642
1643
  if (method.optionalParams.length <= 1) return undefined;
1643
- var paramHash = '';
1644
- method.allParams.forEach(p => paramHash += p.asHashString());
1645
- var hash = (0, _blueimpMd.default)(paramHash);
1646
- var result = this.requestTypes[hash];
1647
- if (!result) result = this.makeRequestType(hash, method);
1644
+ var result = this.types[this.requestTypeName(method)];
1645
+ if (!result) result = this.makeRequestType(method);
1648
1646
  return result;
1649
1647
  }
1650
1648
 
@@ -1659,10 +1657,9 @@ class ApiModel {
1659
1657
  return this.enumTypes;
1660
1658
  }
1661
1659
 
1662
- makeWriteableType(hash, type) {
1660
+ makeWriteableType(type) {
1663
1661
  var writer = new WriteType(this, type);
1664
1662
  this.types[writer.name] = writer;
1665
- this.requestTypes[hash] = writer;
1666
1663
  return writer;
1667
1664
  }
1668
1665
 
@@ -1692,10 +1689,7 @@ class ApiModel {
1692
1689
  }
1693
1690
 
1694
1691
  if (writes.length === props.length && JSON.stringify(writes) === JSON.stringify(props)) return undefined;
1695
- var hash = (0, _blueimpMd.default)(type.asHashString());
1696
- var result = this.requestTypes[hash];
1697
- if (result) return result;
1698
- result = this.makeWriteableType(hash, type);
1692
+ var result = this.makeWriteableType(type);
1699
1693
  type.types.add(result.name);
1700
1694
  type.customTypes.add(result.name);
1701
1695
  result.parentTypes.add(type.name);