@looker/sdk-codegen 21.2.0 → 21.4.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.
package/CHANGELOG.md CHANGED
@@ -5,6 +5,67 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [21.4.0](https://www.github.com/looker-open-source/sdk-codegen/compare/sdk-codegen-v21.3.1...sdk-codegen-v21.4.0) (2022-02-14)
9
+
10
+
11
+ ### ⚠ BREAKING CHANGES
12
+
13
+ * SDK support for 22.0
14
+
15
+ ### Features
16
+
17
+ * fuzzy JSON value handling for the Swift SDK ([#961](https://www.github.com/looker-open-source/sdk-codegen/issues/961)) ([0b6b696](https://www.github.com/looker-open-source/sdk-codegen/commit/0b6b696742d67d1abc0cf69dfbf820f5a28d0f86))
18
+ * SDK build for 22.0. ([#959](https://www.github.com/looker-open-source/sdk-codegen/issues/959)) ([de651b3](https://www.github.com/looker-open-source/sdk-codegen/commit/de651b373978fd3689429c0cbdb364a2820fe211))
19
+ * SDK support for 22.0 ([5f9930c](https://www.github.com/looker-open-source/sdk-codegen/commit/5f9930c0b0f7bde59f0b9b47f882ae1f3ff9e490))
20
+
21
+
22
+ ### Bug Fixes
23
+
24
+ * Update go codegen to set object as interface{} ([#980](https://www.github.com/looker-open-source/sdk-codegen/issues/980)) ([007989d](https://www.github.com/looker-open-source/sdk-codegen/commit/007989d6c438fa42ec261f5b216f2d933b489742))
25
+
26
+ ### [21.3.1](https://www.github.com/looker-open-source/sdk-codegen/compare/sdk-codegen-v21.2.0...sdk-codegen-v21.3.1) (2022-01-27)
27
+
28
+
29
+ ### Features
30
+
31
+ * add http method to IRawResponse ([#925](https://www.github.com/looker-open-source/sdk-codegen/issues/925)) ([25cef47](https://www.github.com/looker-open-source/sdk-codegen/commit/25cef47fa61a5f15565560b48f5e0c45a0cd9b44))
32
+ * support string or numeric JSON format for numeric IDs in Swift ([#937](https://www.github.com/looker-open-source/sdk-codegen/issues/937)) ([1487d8a](https://www.github.com/looker-open-source/sdk-codegen/commit/1487d8a38432cef2e994d14001df18659522ca90))
33
+
34
+
35
+ ### Bug Fixes
36
+
37
+ * enum naming and registration ([#918](https://www.github.com/looker-open-source/sdk-codegen/issues/918)) ([9d4a6cb](https://www.github.com/looker-open-source/sdk-codegen/commit/9d4a6cbfac5defad3a35389e2d46947d2135d349))
38
+
39
+ ### [21.3.1](https://www.github.com/looker-open-source/sdk-codegen/compare/sdk-codegen-v21.3.0...sdk-codegen-v21.3.1) (2021-12-20)
40
+
41
+
42
+ ### Dependencies
43
+
44
+ * The following workspace dependencies were updated
45
+ * dependencies
46
+ * @looker/sdk-rtl bumped from ^21.3.0 to ^21.3.1
47
+
48
+ ## [21.3.0](https://www.github.com/looker-open-source/sdk-codegen/compare/sdk-codegen-v21.2.1...sdk-codegen-v21.3.0) (2021-12-16)
49
+
50
+
51
+ ### Features
52
+
53
+ * add http method to IRawResponse ([#925](https://www.github.com/looker-open-source/sdk-codegen/issues/925)) ([25cef47](https://www.github.com/looker-open-source/sdk-codegen/commit/25cef47fa61a5f15565560b48f5e0c45a0cd9b44))
54
+
55
+
56
+ ### Dependencies
57
+
58
+ * The following workspace dependencies were updated
59
+ * dependencies
60
+ * @looker/sdk-rtl bumped from ^21.2.0 to ^21.3.0
61
+
62
+ ### [21.2.1](https://www.github.com/looker-open-source/sdk-codegen/compare/sdk-codegen-v21.2.0...sdk-codegen-v21.2.1) (2021-12-06)
63
+
64
+
65
+ ### Bug Fixes
66
+
67
+ * enum naming and registration ([#918](https://www.github.com/looker-open-source/sdk-codegen/issues/918)) ([9d4a6cb](https://www.github.com/looker-open-source/sdk-codegen/commit/9d4a6cbfac5defad3a35389e2d46947d2135d349))
68
+
8
69
  ## [21.2.0](https://www.github.com/looker-open-source/sdk-codegen/compare/sdk-codegen-v21.1.1...sdk-codegen-v21.2.0) (2021-11-10)
9
70
 
10
71
 
@@ -243,4 +304,4 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
243
304
 
244
305
  ### Added
245
306
 
246
- - [API spec diff utility](https://github.com/looker-open-source/sdk-codegen/pull/380)
307
+ - [API spec diff utility](https://github.com/looker-open-source/sdk-codegen/pull/380)
package/README.md CHANGED
@@ -1,5 +1,6 @@
1
1
  # Looker SDK code generator core files
2
2
 
3
+
3
4
  This package contains the OpenAPI analysis files, and all source code necessary to generate method and type declarations for supported languages.
4
5
 
5
6
  This package can be used in a browser because it has no node dependencies.
package/lib/esm/go.gen.js CHANGED
@@ -74,6 +74,10 @@ export class GoGen extends CodeGen {
74
74
  this.apiVersion = this.packageName;
75
75
  }
76
76
 
77
+ supportsMultiApi() {
78
+ return false;
79
+ }
80
+
77
81
  reserve(name) {
78
82
  if (this.keywords.has(name)) {
79
83
  return "".concat(name, "0");
@@ -242,11 +246,6 @@ export class GoGen extends CodeGen {
242
246
 
243
247
  modelsPrologue(_indent) {
244
248
  var goImport = "\nimport (\n \"github.com/looker-open-source/sdk-codegen/go/rtl\"\n \"time\"\n)";
245
-
246
- if (this.packageName === 'v3') {
247
- goImport = "\nimport (\n \"github.com/looker-open-source/sdk-codegen/go/rtl\"\n \"net/url\"\n \"time\"\n)";
248
- }
249
-
250
249
  return "\n// ".concat(this.warnEditing(), "\n\npackage ").concat(this.packageName, "\n").concat(goImport, "\n");
251
250
  }
252
251
 
@@ -320,7 +319,7 @@ export class GoGen extends CodeGen {
320
319
  },
321
320
  object: {
322
321
  default: mt,
323
- name: 'struct'
322
+ name: 'interface{}'
324
323
  },
325
324
  password: {
326
325
  default: mt,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/go.gen.ts"],"names":["CodeGen","commentBlock","EnumType","strBody","align","str","size","num","length","repeat","AlignColumnWriter","writeRow","cols","forEach","value","index","sizes","Math","max","rows","push","toString","result","row","rowSize","col","colIndex","trimRight","GoGen","constructor","api","versions","Set","packageName","apiVersion","substring","indexOf","reserve","name","keywords","has","commentHeader","indent","text","noComment","comment","description","commentStr","sdkFileName","baseFileName","fileName","sdkPath","methodSignature","method","methodHeaderDeclaration","streamer","mapped","typeMap","type","head","trim","headComment","httpMethod","endpoint","fragment","requestType","requestTypeName","bump","indentStr","params","args","allParams","p","declareParameter","join","paramDelimiter","responseIsBoth","responseIsBinary","callback","retType","header","toCamelCaseCap","declareMethod","bumper","encodePathParams","httpCall","param","location","writeableType","pOpt","required","default","toCamelCase","paramComment","encodings","pathParams","prefix","useRequest","doEncode","accessor","request","httpArgs","resultDef","resultPointer","capitalize","toUpperCase","apiPath","httpPath","argFill","bodyArg","nullStr","argGroup","queryArgs","_indent","hash","arg","reserved","argDelimiter","path","vars","replace","group","allVars","methodsEpilogue","methodsPrologue","warnEditing","modelsPrologue","goImport","modelsEpilogue","summary","_text","typeSignature","beginRegion","endRegion","mt","ktTypes","any","boolean","byte","date","datetime","double","float","int32","int64","integer","number","object","password","string","uri","url","void","elementType","map","className","mapName","Error","JSON","stringify","declareType","writer","props","propertyValues","typeName","values","declareEnumValue","enumDelimiter","typeProperties","prop","declareProperty","construct","endTypeStr","typename","quote","codeQuote","property","doc","optionalJson","optionalPointer","charAt","slice"],"mappings":";;AA2BA,SAASA,OAAT,EAAkBC,YAAlB,QAAsC,WAAtC;AAUA,SAASC,QAAT,EAAmBC,OAAnB,QAAkC,aAAlC;;AAEA,IAAMC,KAAK,GAAG,CAACC,GAAD,EAAcC,IAAd,KAAuC;AACnD,MAAMC,GAAG,GAAGD,IAAI,GAAGD,GAAG,CAACG,MAAX,GAAoB,CAAhC;AACA,SAAOH,GAAG,GAAG,IAAII,MAAJ,CAAWF,GAAX,CAAb;AACD,CAHD;;AAQA,MAAMG,iBAAN,CAAwB;AAAA;AAAA,kCACU,EADV;;AAAA,mCAEI,EAFJ;AAAA;;AAItBC,EAAAA,QAAQ,GAAoB;AAAA,sCAAhBC,IAAgB;AAAhBA,MAAAA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GAJF;AAMD;;AACD;AACD;;AAEDzE,EAAAA,UAAU,CAACnG,GAAD,EAAsB;AAC9B,WAAOA,GAAG,CAAC+K,MAAJ,CAAW,CAAX,EAAc3E,WAAd,KAA8BpG,GAAG,CAACgL,KAAJ,CAAU,CAAV,CAArC;AACD;;AAEDpG,EAAAA,cAAc,CAAC5E,GAAD,EAAsB;AAClC,WAAO,KAAKmG,UAAL,CACLnG,GAAG,CAACmH,OAAJ,CAAY,cAAZ,EAA6BC,KAAD,IAC1BA,KAAK,CAAChB,WAAN,GAAoBe,OAApB,CAA4B,GAA5B,EAAiC,EAAjC,EAAqCA,OAArC,CAA6C,GAA7C,EAAkD,EAAlD,CADF,CADK,CAAP;AAKD;;AAED5B,EAAAA,WAAW,CAACvF,GAAD,EAAsB;AAC/B,WAAOA,GAAG,CAACmH,OAAJ,CAAY,cAAZ,EAA6BC,KAAD,IACjCA,KAAK,CAAChB,WAAN,GAAoBe,OAApB,CAA4B,GAA5B,EAAiC,EAAjC,EAAqCA,OAArC,CAA6C,GAA7C,EAAkD,EAAlD,CADK,CAAP;AAGD;;AA9fgC","sourcesContent":["/*\n\n MIT License\n\n Copyright (c) 2021 Looker Data Sciences, Inc.\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n\n */\n\nimport type { IMappedType, IVersionInfo } from './codeGen'\nimport { CodeGen, commentBlock } from './codeGen'\nimport type {\n ApiModel,\n Arg,\n EnumValueType,\n IMethod,\n IParameter,\n IProperty,\n IType,\n} from './sdkModels'\nimport { EnumType, strBody } from './sdkModels'\n\nconst align = (str: string, size: number): string => {\n const num = size - str.length + 1\n return str + ' '.repeat(num)\n}\n\n/**\n * AlignColumnWriter writes text aligned by column width, it is used to keep the go struct formatting consistent.\n */\nclass AlignColumnWriter {\n private rows: Array<string[]> = []\n private sizes: number[] = []\n\n writeRow(...cols: string[]) {\n cols.forEach((value, index) => {\n this.sizes[index] = Math.max(this.sizes[index] || 0, value.length)\n })\n this.rows.push(cols)\n }\n\n toString(): string {\n let result = ''\n this.rows.forEach((row) => {\n const rowSize = row.length\n row.forEach((col, colIndex) => {\n result +=\n rowSize - 1 === colIndex ? col : align(col, this.sizes[colIndex])\n })\n result = result.trimRight() + '\\n'\n })\n return result\n }\n}\n\n/**\n * Go generator\n */\nexport class GoGen extends CodeGen {\n codePath = './go'\n fileExtension = '.go'\n nullStr = 'nil'\n packagePath = ''\n commentStr = '// '\n\n enumDelimiter = '\\n'\n indentStr = ' '\n endTypeStr = '}'\n codeQuote = `\"`\n\n useNamedParameters = false\n needsRequestTypes = true\n\n keywords = new Set<string>([\n 'break',\n 'default',\n 'func',\n 'interface',\n 'select',\n 'case',\n 'defer',\n 'go',\n 'map',\n 'struct',\n 'chan',\n 'else',\n 'goto',\n 'package',\n 'switch',\n 'const',\n 'fallthrough',\n 'if',\n 'range',\n 'type',\n 'continue',\n 'for',\n 'import',\n 'return',\n 'var',\n ])\n\n constructor(public api: ApiModel, public versions?: IVersionInfo) {\n super(api, versions)\n this.packageName = `v${this.apiVersion.substring(\n 0,\n this.apiVersion.indexOf('.')\n )}`\n this.apiVersion = this.packageName\n }\n\n reserve(name: string) {\n if (this.keywords.has(name)) {\n return `${name}0`\n }\n return name\n }\n\n commentHeader(indent: string, text: string | undefined) {\n if (this.noComment) return ''\n return text\n ? `${indent}/*\\n\\n${commentBlock(text, indent, '')}\\n${indent}*/\\n`\n : ''\n }\n\n comment(indent: string, description: string) {\n if (this.noComment) return ''\n return commentBlock(description, indent, this.commentStr)\n }\n\n sdkFileName(baseFileName: string) {\n return this.fileName(`${this.sdkPath}/${this.packageName}/${baseFileName}`)\n }\n\n methodSignature(indent: string, method: IMethod): string {\n return this.methodHeaderDeclaration(indent, method, false)\n }\n\n methodHeaderDeclaration(indent: string, method: IMethod, streamer = false) {\n const mapped = this.typeMap(method.type)\n const head = method.description?.trim()\n let headComment =\n (head ? `${head}\\n\\n` : '') +\n `${method.httpMethod} ${method.endpoint} -> ${mapped.name}`\n let fragment = ''\n const requestType = this.requestTypeName(method)\n const bump = indent + this.indentStr\n\n if (requestType) {\n fragment = `request ${requestType}`\n } else {\n const params: string[] = []\n const args = method.allParams // get the params in signature order\n if (args && args.length > 0)\n args.forEach((p) => params.push(this.declareParameter(bump, method, p)))\n fragment =\n params.length > 0 ? `\\n${params.join(this.paramDelimiter)}` : ''\n }\n if (method.responseIsBoth()) {\n headComment += `\\n\\n**Note**: Binary content may be returned by this method.`\n } else if (method.responseIsBinary()) {\n headComment += `\\n\\n**Note**: Binary content is returned by this method.\\n`\n }\n const callback = `callback: (readable: Readable) => Promise<${mapped.name}>,`\n const retType = mapped.name === 'Void' ? '' : `${mapped.name}, `\n const header =\n this.comment('', headComment) +\n '\\n' +\n `func (l *LookerSDK) ${this.toCamelCaseCap(method.name)}(` +\n (streamer ? `\\n${bump}${callback}` : '')\n\n return (\n header +\n fragment +\n `${\n fragment ? ',' : ''\n }\\n${bump}options *rtl.ApiSettings) (${retType}error) {\\n`\n )\n }\n\n declareMethod(indent: string, method: IMethod) {\n const bump = this.bumper(indent)\n return (\n this.methodSignature(indent, method) +\n this.encodePathParams(bump, method) +\n this.httpCall(bump, method) +\n `\\n}`\n )\n }\n\n declareParameter(indent: string, method: IMethod, param: IParameter) {\n const type =\n param.location === strBody\n ? this.writeableType(param.type, method) || param.type\n : param.type\n const mapped = this.typeMap(type)\n let pOpt = ''\n if (param.location === strBody) {\n mapped.name = `${mapped.name}`\n }\n if (!param.required) {\n pOpt = mapped.default ? '' : '*'\n }\n return (\n // this.commentHeader(indent, this.paramComment(param, mapped)) +\n `${indent}${this.toCamelCase(this.reserve(param.name))} ${pOpt}${\n mapped.name\n }`\n )\n }\n\n paramComment(param: IParameter, mapped: IMappedType) {\n return `@param {${mapped.name}} ${param.name} ${param.description}`\n }\n\n encodePathParams(indent: string, method: IMethod) {\n let encodings = ''\n if (method.pathParams.length > 0) {\n const prefix = this.useRequest(method) ? 'request' : ''\n for (const param of method.pathParams) {\n if (param.doEncode()) {\n const name = this.accessor(param.name, prefix)\n\n encodings += `${indent}${name} = url.PathEscape(${name})\\n`\n }\n }\n }\n return encodings\n }\n\n httpCall(indent: string, method: IMethod) {\n const request = this.useRequest(method) ? 'request' : ''\n const mapped = this.typeMap(method.type)\n const bump = indent + this.indentStr\n const args = this.httpArgs(bump, method)\n // const errors = this.errorResponses(indent, method)\n const resultDef =\n mapped.name === 'Void' ? '' : `${indent}var result ${mapped.name}\\n`\n const resultPointer = mapped.name === 'Void' ? 'nil' : `&result`\n const result = mapped.name === 'Void' ? '' : 'result, '\n return (\n `` +\n resultDef +\n `${indent}err := l.session.Do(${resultPointer}, \"${this.capitalize(\n method.httpMethod.toUpperCase()\n )}\", \"${this.apiPath}\", ${this.httpPath(method.endpoint, request)}` +\n `${args ? ', ' + args : ''})` +\n '\\n' +\n `${indent}return ${result}err` +\n '\\n'\n )\n }\n\n // build the http argument list from back to front, so trailing undefined arguments\n // can be omitted. Path arguments are resolved as part of the path parameter to general\n // purpose API method call\n // e.g.\n // {queryArgs...}, bodyArg, {headerArgs...}, {cookieArgs...}\n // {queryArgs...}, null, null, {cookieArgs...}\n // null, bodyArg\n // {queryArgs...}\n httpArgs(indent: string, method: IMethod) {\n const request = this.useRequest(method) ? 'request' : ''\n // add options at the end of the request calls. this will cause all other arguments to be\n // filled in but there's no way to avoid this for passing in the last optional parameter.\n // Fortunately, this code bloat is minimal and also hidden from the consumer.\n let result = this.argFill('', 'options')\n // let result = this.argFill('', this.argGroup(indent, method.cookieArgs, request))\n // result = this.argFill(result, this.argGroup(indent, method.headerArgs, request))\n result = this.argFill(\n result,\n method.bodyArg ? this.accessor(method.bodyArg, request) : this.nullStr\n )\n result = this.argFill(\n result,\n this.argGroup(indent, method.queryArgs, request)\n )\n return result\n }\n\n argGroup(_indent: string, args: Arg[], prefix?: string) {\n if (!args || args.length === 0) return this.nullStr\n const hash: string[] = []\n for (const arg of args) {\n const reserved = this.reserve(arg)\n if (prefix) {\n hash.push(`\"${reserved}\": ${this.accessor(arg, prefix)}`)\n } else {\n hash.push(`\"${reserved}\": ${this.toCamelCase(reserved)}`)\n }\n }\n return `map[string]interface{}{${hash.join(this.argDelimiter)}}`\n }\n\n httpPath(path: string, prefix?: string) {\n prefix = prefix || ''\n if (path.indexOf('{') >= 0) {\n const vars: Array<string> = []\n const str = path.replace(/({.*?})/g, (group) => {\n vars.push(\n this.accessor(group.replace('{', '').replace('}', ''), prefix)\n )\n return '%v'\n })\n const allVars = vars.join(', ')\n return allVars ? `fmt.Sprintf(\"${str}\", ${allVars})` : `\"${str}\"`\n }\n return `\"${path}\"`\n }\n\n /**\n * Determine the type of accessor needed for the symbol name\n *\n * If the prefix is defined:\n * If the name is special, use array accessor\n * If the name is simple, use dotted notation\n *\n * With no prefix, return the \"reserved\" version of the name, which may be the same as name\n *\n * @param name variable to access\n * @param prefix optional prefix for accessor\n * @returns one of 4 possible accessor patterns\n */\n accessor(name: string, prefix?: string) {\n const reserved = this.reserve(this.toCamelCase(name))\n if (!prefix) return reserved\n return `${prefix}.${this.toCamelCaseCap(name)}`\n // if (reserved === name) return `${prefix}.${name}`\n // return `${prefix}[${reserved}]`\n }\n\n methodsEpilogue(_indent: string): string {\n return ''\n }\n\n methodsPrologue(_indent: string): string {\n return `\n// ${this.warnEditing()}\n\npackage ${this.packageName}\n\nimport (\n \"fmt\"\n \"github.com/looker-open-source/sdk-codegen/go/rtl\"\n \"net/url\"\n \"time\"\n)\n\ntype LookerSDK struct {\n session *rtl.AuthSession\n}\n\nfunc NewLookerSDK(session *rtl.AuthSession) *LookerSDK {\n return &LookerSDK{\n session: session,\n }\n}\n`\n }\n\n modelsPrologue(_indent: string) {\n let goImport = `\nimport (\n \"github.com/looker-open-source/sdk-codegen/go/rtl\"\n \"time\"\n)`\n\n // v3 still uses url.URL\n if (this.packageName === 'v3') {\n goImport = `\nimport (\n \"github.com/looker-open-source/sdk-codegen/go/rtl\"\n \"net/url\"\n \"time\"\n)`\n }\n return `\n// ${this.warnEditing()}\n\npackage ${this.packageName}\n${goImport}\n`\n }\n\n modelsEpilogue(_indent: string): string {\n return ''\n }\n\n summary(_indent: string, _text: string | undefined): string {\n return ''\n }\n\n typeSignature(indent: string, type: IType): string {\n return (\n this.comment(indent, type.description) +\n '\\n' +\n `${indent}type ${type.name} struct {\\n`\n )\n }\n\n beginRegion(indent: string, description: string): string {\n return `${indent}// region ${description}`\n }\n\n endRegion(indent: string, description: string): string {\n return `${indent}// endregion ${description}`\n }\n\n typeMap(type: IType): IMappedType {\n super.typeMap(type)\n const mt = this.nullStr\n const ktTypes: Record<string, IMappedType> = {\n any: { default: mt, name: 'interface{}' },\n boolean: { default: mt, name: 'bool' },\n byte: { default: mt, name: 'byte' },\n date: { default: mt, name: 'time.Time' },\n datetime: { default: mt, name: 'time.Time' },\n double: { default: mt, name: 'float64' },\n float: { default: mt, name: 'float32' },\n int32: { default: mt, name: 'int32' },\n int64: { default: mt, name: 'int64' },\n integer: { default: mt, name: 'int' },\n number: { default: mt, name: 'float64' },\n object: { default: mt, name: 'struct' },\n password: { default: mt, name: 'string' },\n string: { default: mt, name: 'string' },\n uri: { default: mt, name: 'url.URL' },\n url: { default: mt, name: 'url.URL' },\n void: { default: mt, name: 'Void' }, // todo: check how to handle Void\n }\n\n if (type.elementType) {\n // This is a structure with nested types\n const map = this.typeMap(type.elementType)\n switch (type.className) {\n case 'ArrayType':\n return { default: this.nullStr, name: `[]${map.name}` }\n case 'HashType': {\n const mapName =\n type.elementType.name === 'string' ? 'interface{}' : map.name // TODO fix bad API spec, like MergeQuery vis_config\n // TODO figure out this bizarre string template error either in IntelliJ or TypeScript\n // return {name: `Map<String,${map.name}>`, default: '{}'}\n return {\n default: this.nullStr,\n name: 'map[string]' + `${mapName}`,\n }\n }\n case 'DelimArrayType':\n return {\n default: this.nullStr,\n name: `rtl.Delim${this.capitalize(map.name)}`,\n }\n case 'EnumType':\n return { default: '', name: this.capitalize(type.name) }\n }\n throw new Error(`Don't know how to handle: ${JSON.stringify(type)}`)\n }\n\n if (type.name) {\n return (\n ktTypes[type.name] || { default: this.nullStr, name: `${type.name}` }\n )\n } else {\n throw new Error('Cannot output a nameless type.')\n }\n }\n\n declareType(indent: string, type: IType) {\n const bump = this.bumper(indent)\n\n const writer = new AlignColumnWriter()\n\n try {\n if (type instanceof EnumType) {\n // enum has special handling\n const props: string[] = []\n let propertyValues = ''\n const num = type as EnumType\n const typeName = this.capitalize(type.name)\n props.push(`type ${typeName} string`) // todo: handle other types than string\n num.values.forEach((value) => {\n // props.push(this.declareEnumValue(bump, value, typeName))\n this.declareEnumValue(bump, value, typeName, writer)\n })\n props.push(writer.toString())\n propertyValues = props.join(this.enumDelimiter)\n\n return propertyValues\n } else {\n this.typeProperties(type).forEach((prop) =>\n // props.push(this.declareProperty(bump, prop))\n this.declareProperty(bump, prop, writer)\n )\n // propertyValues = props.join(this.propDelimiter)\n }\n } catch {\n throw new Error(JSON.stringify(type, null, 2))\n }\n return (\n this.typeSignature(indent, type) +\n writer.toString() +\n this.construct(indent, type) +\n `${this.endTypeStr ? indent : ''}${this.endTypeStr}`\n )\n }\n\n declareEnumValue(\n _indent: string,\n value: EnumValueType,\n typename?: string,\n writer?: AlignColumnWriter\n ) {\n const quote = typeof value === 'string' ? this.codeQuote : ''\n const name = `${typename}_${this.toCamelCaseCap(value.toString())}`\n if (writer) {\n writer.writeRow(\n 'const',\n name,\n typename || '',\n '=',\n `${quote}${value}${quote}`\n )\n }\n return `const ${name} ${typename} = ${quote}${value}${quote}`\n }\n\n declareProperty(\n indent: string,\n property: IProperty,\n writer?: AlignColumnWriter\n ): string {\n const type = this.typeMap(property.type)\n const name = this.toCamelCaseCap(property.name)\n const typeName = type.name\n\n const doc = property.description\n ? `${this.comment(' ', property.description)}`\n : ''\n\n const optionalJson = property.required ? '' : ',omitempty'\n const optionalPointer = property.required ? '' : '*'\n\n if (writer) {\n writer.writeRow(\n `${indent}${name}`,\n `${optionalPointer}${typeName}`,\n `\\`json:\"${property.name}${optionalJson}\"\\``,\n doc\n )\n }\n return ``\n }\n\n capitalize(str: string): string {\n return str.charAt(0).toUpperCase() + str.slice(1)\n }\n\n toCamelCaseCap(str: string): string {\n return this.capitalize(\n str.replace(/([-_][a-z])/g, (group) =>\n group.toUpperCase().replace('-', '').replace('_', '')\n )\n )\n }\n\n toCamelCase(str: string): string {\n return str.replace(/([-_][a-z])/g, (group) =>\n group.toUpperCase().replace('-', '').replace('_', '')\n )\n }\n}\n"],"file":"go.gen.js"}
1
+ {"version":3,"sources":["../../src/go.gen.ts"],"names":["CodeGen","commentBlock","EnumType","strBody","align","str","size","num","length","repeat","AlignColumnWriter","writeRow","cols","forEach","value","index","sizes","Math","max","rows","push","toString","result","row","rowSize","col","colIndex","trimRight","GoGen","constructor","api","versions","Set","packageName","apiVersion","substring","indexOf","supportsMultiApi","reserve","name","keywords","has","commentHeader","indent","text","noComment","comment","description","commentStr","sdkFileName","baseFileName","fileName","sdkPath","methodSignature","method","methodHeaderDeclaration","streamer","mapped","typeMap","type","head","trim","headComment","httpMethod","endpoint","fragment","requestType","requestTypeName","bump","indentStr","params","args","allParams","p","declareParameter","join","paramDelimiter","responseIsBoth","responseIsBinary","callback","retType","header","toCamelCaseCap","declareMethod","bumper","encodePathParams","httpCall","param","location","writeableType","pOpt","required","default","toCamelCase","paramComment","encodings","pathParams","prefix","useRequest","doEncode","accessor","request","httpArgs","resultDef","resultPointer","capitalize","toUpperCase","apiPath","httpPath","argFill","bodyArg","nullStr","argGroup","queryArgs","_indent","hash","arg","reserved","argDelimiter","path","vars","replace","group","allVars","methodsEpilogue","methodsPrologue","warnEditing","modelsPrologue","goImport","modelsEpilogue","summary","_text","typeSignature","beginRegion","endRegion","mt","ktTypes","any","boolean","byte","date","datetime","double","float","int32","int64","integer","number","object","password","string","uri","url","void","elementType","map","className","mapName","Error","JSON","stringify","declareType","writer","props","propertyValues","typeName","values","declareEnumValue","enumDelimiter","typeProperties","prop","declareProperty","construct","endTypeStr","typename","quote","codeQuote","property","doc","optionalJson","optionalPointer","charAt","slice"],"mappings":";;AA2BA,SAASA,OAAT,EAAkBC,YAAlB,QAAsC,WAAtC;AAUA,SAASC,QAAT,EAAmBC,OAAnB,QAAkC,aAAlC;;AAEA,IAAMC,KAAK,GAAG,CAACC,GAAD,EAAcC,IAAd,KAAuC;AACnD,MAAMC,GAAG,GAAGD,IAAI,GAAGD,GAAG,CAACG,MAAX,GAAoB,CAAhC;AACA,SAAOH,GAAG,GAAG,IAAII,MAAJ,CAAWF,GAAX,CAAb;AACD,CAHD;;AAQA,MAAMG,iBAAN,CAAwB;AAAA;AAAA,kCACU,EADV;;AAAA,mCAEI,EAFJ;AAAA;;AAItBC,EAAAA,QAAQ,GAAoB;AAAA,sCAAhBC,IAAgB;AAAhBA,MAAAA,IAAgB;AAAA;;AAC1BA,IAAAA,IAAI,CAACC,OAAL,CAAa,CAACC,KAAD,EAAQC,KAAR,KAAkB;AAC7B,WAAKC,KAAL,CAAWD,KAAX,IAAoBE,IAAI,CAACC,GAAL,CAAS,KAAKF,KAAL,CAAWD,KAAX,KAAqB,CAA9B,EAAi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,KAAKoG,UAAL,CACLpG,GAAG,CAACoH,OAAJ,CAAY,cAAZ,EAA6BC,KAAD,IAC1BA,KAAK,CAAChB,WAAN,GAAoBe,OAApB,CAA4B,GAA5B,EAAiC,EAAjC,EAAqCA,OAArC,CAA6C,GAA7C,EAAkD,EAAlD,CADF,CADK,CAAP;AAKD;;AAED5B,EAAAA,WAAW,CAACxF,GAAD,EAAsB;AAC/B,WAAOA,GAAG,CAACoH,OAAJ,CAAY,cAAZ,EAA6BC,KAAD,IACjCA,KAAK,CAAChB,WAAN,GAAoBe,OAApB,CAA4B,GAA5B,EAAiC,EAAjC,EAAqCA,OAArC,CAA6C,GAA7C,EAAkD,EAAlD,CADK,CAAP;AAGD;;AAzfgC","sourcesContent":["/*\n\n MIT License\n\n Copyright (c) 2021 Looker Data Sciences, Inc.\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n\n */\n\nimport type { IMappedType, IVersionInfo } from './codeGen'\nimport { CodeGen, commentBlock } from './codeGen'\nimport type {\n ApiModel,\n Arg,\n EnumValueType,\n IMethod,\n IParameter,\n IProperty,\n IType,\n} from './sdkModels'\nimport { EnumType, strBody } from './sdkModels'\n\nconst align = (str: string, size: number): string => {\n const num = size - str.length + 1\n return str + ' '.repeat(num)\n}\n\n/**\n * AlignColumnWriter writes text aligned by column width, it is used to keep the go struct formatting consistent.\n */\nclass AlignColumnWriter {\n private rows: Array<string[]> = []\n private sizes: number[] = []\n\n writeRow(...cols: string[]) {\n cols.forEach((value, index) => {\n this.sizes[index] = Math.max(this.sizes[index] || 0, value.length)\n })\n this.rows.push(cols)\n }\n\n toString(): string {\n let result = ''\n this.rows.forEach((row) => {\n const rowSize = row.length\n row.forEach((col, colIndex) => {\n result +=\n rowSize - 1 === colIndex ? col : align(col, this.sizes[colIndex])\n })\n result = result.trimRight() + '\\n'\n })\n return result\n }\n}\n\n/**\n * Go generator\n */\nexport class GoGen extends CodeGen {\n codePath = './go'\n fileExtension = '.go'\n nullStr = 'nil'\n packagePath = ''\n commentStr = '// '\n\n enumDelimiter = '\\n'\n indentStr = ' '\n endTypeStr = '}'\n codeQuote = `\"`\n\n useNamedParameters = false\n needsRequestTypes = true\n\n keywords = new Set<string>([\n 'break',\n 'default',\n 'func',\n 'interface',\n 'select',\n 'case',\n 'defer',\n 'go',\n 'map',\n 'struct',\n 'chan',\n 'else',\n 'goto',\n 'package',\n 'switch',\n 'const',\n 'fallthrough',\n 'if',\n 'range',\n 'type',\n 'continue',\n 'for',\n 'import',\n 'return',\n 'var',\n ])\n\n constructor(public api: ApiModel, public versions?: IVersionInfo) {\n super(api, versions)\n this.packageName = `v${this.apiVersion.substring(\n 0,\n this.apiVersion.indexOf('.')\n )}`\n this.apiVersion = this.packageName\n }\n\n supportsMultiApi(): boolean {\n return false\n }\n\n reserve(name: string) {\n if (this.keywords.has(name)) {\n return `${name}0`\n }\n return name\n }\n\n commentHeader(indent: string, text: string | undefined) {\n if (this.noComment) return ''\n return text\n ? `${indent}/*\\n\\n${commentBlock(text, indent, '')}\\n${indent}*/\\n`\n : ''\n }\n\n comment(indent: string, description: string) {\n if (this.noComment) return ''\n return commentBlock(description, indent, this.commentStr)\n }\n\n sdkFileName(baseFileName: string) {\n return this.fileName(`${this.sdkPath}/${this.packageName}/${baseFileName}`)\n }\n\n methodSignature(indent: string, method: IMethod): string {\n return this.methodHeaderDeclaration(indent, method, false)\n }\n\n methodHeaderDeclaration(indent: string, method: IMethod, streamer = false) {\n const mapped = this.typeMap(method.type)\n const head = method.description?.trim()\n let headComment =\n (head ? `${head}\\n\\n` : '') +\n `${method.httpMethod} ${method.endpoint} -> ${mapped.name}`\n let fragment = ''\n const requestType = this.requestTypeName(method)\n const bump = indent + this.indentStr\n\n if (requestType) {\n fragment = `request ${requestType}`\n } else {\n const params: string[] = []\n const args = method.allParams // get the params in signature order\n if (args && args.length > 0)\n args.forEach((p) => params.push(this.declareParameter(bump, method, p)))\n fragment =\n params.length > 0 ? `\\n${params.join(this.paramDelimiter)}` : ''\n }\n if (method.responseIsBoth()) {\n headComment += `\\n\\n**Note**: Binary content may be returned by this method.`\n } else if (method.responseIsBinary()) {\n headComment += `\\n\\n**Note**: Binary content is returned by this method.\\n`\n }\n const callback = `callback: (readable: Readable) => Promise<${mapped.name}>,`\n const retType = mapped.name === 'Void' ? '' : `${mapped.name}, `\n const header =\n this.comment('', headComment) +\n '\\n' +\n `func (l *LookerSDK) ${this.toCamelCaseCap(method.name)}(` +\n (streamer ? `\\n${bump}${callback}` : '')\n\n return (\n header +\n fragment +\n `${\n fragment ? ',' : ''\n }\\n${bump}options *rtl.ApiSettings) (${retType}error) {\\n`\n )\n }\n\n declareMethod(indent: string, method: IMethod) {\n const bump = this.bumper(indent)\n return (\n this.methodSignature(indent, method) +\n this.encodePathParams(bump, method) +\n this.httpCall(bump, method) +\n `\\n}`\n )\n }\n\n declareParameter(indent: string, method: IMethod, param: IParameter) {\n const type =\n param.location === strBody\n ? this.writeableType(param.type, method) || param.type\n : param.type\n const mapped = this.typeMap(type)\n let pOpt = ''\n if (param.location === strBody) {\n mapped.name = `${mapped.name}`\n }\n if (!param.required) {\n pOpt = mapped.default ? '' : '*'\n }\n return (\n // this.commentHeader(indent, this.paramComment(param, mapped)) +\n `${indent}${this.toCamelCase(this.reserve(param.name))} ${pOpt}${\n mapped.name\n }`\n )\n }\n\n paramComment(param: IParameter, mapped: IMappedType) {\n return `@param {${mapped.name}} ${param.name} ${param.description}`\n }\n\n encodePathParams(indent: string, method: IMethod) {\n let encodings = ''\n if (method.pathParams.length > 0) {\n const prefix = this.useRequest(method) ? 'request' : ''\n for (const param of method.pathParams) {\n if (param.doEncode()) {\n const name = this.accessor(param.name, prefix)\n\n encodings += `${indent}${name} = url.PathEscape(${name})\\n`\n }\n }\n }\n return encodings\n }\n\n httpCall(indent: string, method: IMethod) {\n const request = this.useRequest(method) ? 'request' : ''\n const mapped = this.typeMap(method.type)\n const bump = indent + this.indentStr\n const args = this.httpArgs(bump, method)\n // const errors = this.errorResponses(indent, method)\n const resultDef =\n mapped.name === 'Void' ? '' : `${indent}var result ${mapped.name}\\n`\n const resultPointer = mapped.name === 'Void' ? 'nil' : `&result`\n const result = mapped.name === 'Void' ? '' : 'result, '\n return (\n `` +\n resultDef +\n `${indent}err := l.session.Do(${resultPointer}, \"${this.capitalize(\n method.httpMethod.toUpperCase()\n )}\", \"${this.apiPath}\", ${this.httpPath(method.endpoint, request)}` +\n `${args ? ', ' + args : ''})` +\n '\\n' +\n `${indent}return ${result}err` +\n '\\n'\n )\n }\n\n // build the http argument list from back to front, so trailing undefined arguments\n // can be omitted. Path arguments are resolved as part of the path parameter to general\n // purpose API method call\n // e.g.\n // {queryArgs...}, bodyArg, {headerArgs...}, {cookieArgs...}\n // {queryArgs...}, null, null, {cookieArgs...}\n // null, bodyArg\n // {queryArgs...}\n httpArgs(indent: string, method: IMethod) {\n const request = this.useRequest(method) ? 'request' : ''\n // add options at the end of the request calls. this will cause all other arguments to be\n // filled in but there's no way to avoid this for passing in the last optional parameter.\n // Fortunately, this code bloat is minimal and also hidden from the consumer.\n let result = this.argFill('', 'options')\n // let result = this.argFill('', this.argGroup(indent, method.cookieArgs, request))\n // result = this.argFill(result, this.argGroup(indent, method.headerArgs, request))\n result = this.argFill(\n result,\n method.bodyArg ? this.accessor(method.bodyArg, request) : this.nullStr\n )\n result = this.argFill(\n result,\n this.argGroup(indent, method.queryArgs, request)\n )\n return result\n }\n\n argGroup(_indent: string, args: Arg[], prefix?: string) {\n if (!args || args.length === 0) return this.nullStr\n const hash: string[] = []\n for (const arg of args) {\n const reserved = this.reserve(arg)\n if (prefix) {\n hash.push(`\"${reserved}\": ${this.accessor(arg, prefix)}`)\n } else {\n hash.push(`\"${reserved}\": ${this.toCamelCase(reserved)}`)\n }\n }\n return `map[string]interface{}{${hash.join(this.argDelimiter)}}`\n }\n\n httpPath(path: string, prefix?: string) {\n prefix = prefix || ''\n if (path.indexOf('{') >= 0) {\n const vars: Array<string> = []\n const str = path.replace(/({.*?})/g, (group) => {\n vars.push(\n this.accessor(group.replace('{', '').replace('}', ''), prefix)\n )\n return '%v'\n })\n const allVars = vars.join(', ')\n return allVars ? `fmt.Sprintf(\"${str}\", ${allVars})` : `\"${str}\"`\n }\n return `\"${path}\"`\n }\n\n /**\n * Determine the type of accessor needed for the symbol name\n *\n * If the prefix is defined:\n * If the name is special, use array accessor\n * If the name is simple, use dotted notation\n *\n * With no prefix, return the \"reserved\" version of the name, which may be the same as name\n *\n * @param name variable to access\n * @param prefix optional prefix for accessor\n * @returns one of 4 possible accessor patterns\n */\n accessor(name: string, prefix?: string) {\n const reserved = this.reserve(this.toCamelCase(name))\n if (!prefix) return reserved\n return `${prefix}.${this.toCamelCaseCap(name)}`\n // if (reserved === name) return `${prefix}.${name}`\n // return `${prefix}[${reserved}]`\n }\n\n methodsEpilogue(_indent: string): string {\n return ''\n }\n\n methodsPrologue(_indent: string): string {\n return `\n// ${this.warnEditing()}\n\npackage ${this.packageName}\n\nimport (\n \"fmt\"\n \"github.com/looker-open-source/sdk-codegen/go/rtl\"\n \"net/url\"\n \"time\"\n)\n\ntype LookerSDK struct {\n session *rtl.AuthSession\n}\n\nfunc NewLookerSDK(session *rtl.AuthSession) *LookerSDK {\n return &LookerSDK{\n session: session,\n }\n}\n`\n }\n\n modelsPrologue(_indent: string) {\n const goImport = `\nimport (\n \"github.com/looker-open-source/sdk-codegen/go/rtl\"\n \"time\"\n)`\n\n return `\n// ${this.warnEditing()}\n\npackage ${this.packageName}\n${goImport}\n`\n }\n\n modelsEpilogue(_indent: string): string {\n return ''\n }\n\n summary(_indent: string, _text: string | undefined): string {\n return ''\n }\n\n typeSignature(indent: string, type: IType): string {\n return (\n this.comment(indent, type.description) +\n '\\n' +\n `${indent}type ${type.name} struct {\\n`\n )\n }\n\n beginRegion(indent: string, description: string): string {\n return `${indent}// region ${description}`\n }\n\n endRegion(indent: string, description: string): string {\n return `${indent}// endregion ${description}`\n }\n\n typeMap(type: IType): IMappedType {\n super.typeMap(type)\n const mt = this.nullStr\n const ktTypes: Record<string, IMappedType> = {\n any: { default: mt, name: 'interface{}' },\n boolean: { default: mt, name: 'bool' },\n byte: { default: mt, name: 'byte' },\n date: { default: mt, name: 'time.Time' },\n datetime: { default: mt, name: 'time.Time' },\n double: { default: mt, name: 'float64' },\n float: { default: mt, name: 'float32' },\n int32: { default: mt, name: 'int32' },\n int64: { default: mt, name: 'int64' },\n integer: { default: mt, name: 'int' },\n number: { default: mt, name: 'float64' },\n object: { default: mt, name: 'interface{}' },\n password: { default: mt, name: 'string' },\n string: { default: mt, name: 'string' },\n uri: { default: mt, name: 'url.URL' },\n url: { default: mt, name: 'url.URL' },\n void: { default: mt, name: 'Void' }, // todo: check how to handle Void\n }\n\n if (type.elementType) {\n // This is a structure with nested types\n const map = this.typeMap(type.elementType)\n switch (type.className) {\n case 'ArrayType':\n return { default: this.nullStr, name: `[]${map.name}` }\n case 'HashType': {\n const mapName =\n type.elementType.name === 'string' ? 'interface{}' : map.name // TODO fix bad API spec, like MergeQuery vis_config\n // TODO figure out this bizarre string template error either in IntelliJ or TypeScript\n // return {name: `Map<String,${map.name}>`, default: '{}'}\n return {\n default: this.nullStr,\n name: 'map[string]' + `${mapName}`,\n }\n }\n case 'DelimArrayType':\n return {\n default: this.nullStr,\n name: `rtl.Delim${this.capitalize(map.name)}`,\n }\n case 'EnumType':\n return { default: '', name: this.capitalize(type.name) }\n }\n throw new Error(`Don't know how to handle: ${JSON.stringify(type)}`)\n }\n\n if (type.name) {\n return (\n ktTypes[type.name] || { default: this.nullStr, name: `${type.name}` }\n )\n } else {\n throw new Error('Cannot output a nameless type.')\n }\n }\n\n declareType(indent: string, type: IType) {\n const bump = this.bumper(indent)\n\n const writer = new AlignColumnWriter()\n\n try {\n if (type instanceof EnumType) {\n // enum has special handling\n const props: string[] = []\n let propertyValues = ''\n const num = type as EnumType\n const typeName = this.capitalize(type.name)\n props.push(`type ${typeName} string`) // todo: handle other types than string\n num.values.forEach((value) => {\n // props.push(this.declareEnumValue(bump, value, typeName))\n this.declareEnumValue(bump, value, typeName, writer)\n })\n props.push(writer.toString())\n propertyValues = props.join(this.enumDelimiter)\n\n return propertyValues\n } else {\n this.typeProperties(type).forEach((prop) =>\n // props.push(this.declareProperty(bump, prop))\n this.declareProperty(bump, prop, writer)\n )\n // propertyValues = props.join(this.propDelimiter)\n }\n } catch {\n throw new Error(JSON.stringify(type, null, 2))\n }\n return (\n this.typeSignature(indent, type) +\n writer.toString() +\n this.construct(indent, type) +\n `${this.endTypeStr ? indent : ''}${this.endTypeStr}`\n )\n }\n\n declareEnumValue(\n _indent: string,\n value: EnumValueType,\n typename?: string,\n writer?: AlignColumnWriter\n ) {\n const quote = typeof value === 'string' ? this.codeQuote : ''\n const name = `${typename}_${this.toCamelCaseCap(value.toString())}`\n if (writer) {\n writer.writeRow(\n 'const',\n name,\n typename || '',\n '=',\n `${quote}${value}${quote}`\n )\n }\n return `const ${name} ${typename} = ${quote}${value}${quote}`\n }\n\n declareProperty(\n indent: string,\n property: IProperty,\n writer?: AlignColumnWriter\n ): string {\n const type = this.typeMap(property.type)\n const name = this.toCamelCaseCap(property.name)\n const typeName = type.name\n\n const doc = property.description\n ? `${this.comment(' ', property.description)}`\n : ''\n\n const optionalJson = property.required ? '' : ',omitempty'\n const optionalPointer = property.required ? '' : '*'\n\n if (writer) {\n writer.writeRow(\n `${indent}${name}`,\n `${optionalPointer}${typeName}`,\n `\\`json:\"${property.name}${optionalJson}\"\\``,\n doc\n )\n }\n return ``\n }\n\n capitalize(str: string): string {\n return str.charAt(0).toUpperCase() + str.slice(1)\n }\n\n toCamelCaseCap(str: string): string {\n return this.capitalize(\n str.replace(/([-_][a-z])/g, (group) =>\n group.toUpperCase().replace('-', '').replace('_', '')\n )\n )\n }\n\n toCamelCase(str: string): string {\n return str.replace(/([-_][a-z])/g, (group) =>\n group.toUpperCase().replace('-', '').replace('_', '')\n )\n }\n}\n"],"file":"go.gen.js"}
@@ -444,6 +444,11 @@ export class PythonGen extends CodeGen {
444
444
  name: 'str',
445
445
  asVal: asString
446
446
  },
447
+ object: {
448
+ default: this.nullStr,
449
+ name: 'str',
450
+ asVal: asString
451
+ },
447
452
  uri: {
448
453
  default: this.nullStr,
449
454
  name: 'str',
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/python.gen.ts"],"names":["EnumType","strBody","CodeGen","trimInputs","PythonGen","indentStr","repeat","Set","_indent","warnEditing","packagePath","packageName","apiVersion","structureHookFR","apiRef","structureHookTK","hooks","join","prop","required","type","customType","includes","className","sdkFileName","baseFileName","fileName","argGroup","args","length","nullStr","hash","arg","push","dataStructureDelimiter","beginRegion","indent","description","endRegion","_description","declareProperty","property","annotations","mappedType","typeMapModels","propName","name","pythonKeywords","has","propType","propDef","annotation","isBareForwardRef","bumper","methodReturnType","method","typeMapMethods","returnType","responseIsBoth","responseIsBinary","methodSignature","bump","params","allParams","forEach","p","declareParameter","head","trim","httpMethod","endpoint","commentHeader","paramDelimiter","param","location","writeableType","mapped","paramType","default","makeTheCall","inputs","origDelim","argDelimiter","resp","assignParams","initArg","declareType","decl","invalid","typeProperties","Object","values","requiredProperties","concat","optionalProperties","construct","inits","declareConstructorArg","result","properties","some","argFill","current","delimiter","match","replace","httpArgs","callerIndent","currIndent","bodyArg","queryArgs","queryParams","test","httpCall","deprecation","callOpener","it","toLowerCase","callArgs","callCloser","returnStmt","encodePathParams","encodings","pathParams","doEncode","declareMethod","summary","typeSignature","b2","attrs","isEnum","baseClass","usesReservedPythonKeyword","attr","forwardRef","text","prefixModelsNamespace","format","typeMap","asString","_","v","pythonTypes","any","boolean","byte","datetime","double","float","int32","int64","integer","number","password","asVal","string","uri","void","elementType","map","typeName","defaultValue","Error","JSON","stringify","mt"],"mappings":";;AAkCA,SAASA,QAAT,EAAmBC,OAAnB,QAAkC,aAAlC;AAEA,SAASC,OAAT,EAAkBC,UAAlB,QAAoC,WAApC;AAEA,OAAO,MAAMC,SAAN,SAAwBF,OAAxB,CAAgC;AAAA;AAAA;;AAAA,sCAC1B,WAD0B;;AAAA,yCAEvB,YAFuB;;AAAA,oCAG5B,MAH4B;;AAAA,2CAIrB,KAJqB;;AAAA,wCAKxB,IALwB;;AAAA,qCAM3B,MAN2B;;AAAA,uCAQzB,MARyB;;AAAA,uDAShB,KAAKG,SAAL,CAAeC,MAAf,CAAsB,CAAtB,CATgB;;AAAA,uCAUzB,GAVyB;;AAAA,4CAWpB,KAXoB;;AAAA,2CAYrB,IAZqB;;AAAA,oDAaZ,IAbY;;AAAA,2CAcrB,IAdqB;;AAAA,uCAezB,GAfyB;;AAAA,sCAgB1B,GAhB0B;;AAAA,uCAiBzB,GAjByB;;AAAA,0CAkBtB,GAlBsB;;AAAA,mDAmBb,IAnBa;;AAAA,wCAqBxB,EArBwB;;AAAA,4CAwBpB,IAAIC,GAAJ,CAAgB,CAC/B,OAD+B,EAE/B,MAF+B,EAG/B,MAH+B,EAI/B,KAJ+B,EAK/B,IAL+B,EAM/B,QAN+B,EAO/B,OAP+B,EAQ/B,OAR+B,EAS/B,OAT+B,EAU/B,OAV+B,EAW/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Ac,CAACpC,IAAD,EAAc;AAC1B,WAAO,KAAKsH,OAAL,CAAatH,IAAb,EAAmB,SAAnB,CAAP;AACD;;AAEDwB,EAAAA,aAAa,CAACxB,IAAD,EAAc;AACzB,WAAO,KAAKsH,OAAL,CAAatH,IAAb,EAAmB,QAAnB,CAAP;AACD;;AAjjBoC","sourcesContent":["/*\n\n MIT License\n\n Copyright (c) 2021 Looker Data Sciences, Inc.\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n\n */\n\nimport type {\n Arg,\n ArgValues,\n IMethod,\n IParameter,\n IProperty,\n IType,\n} from './sdkModels'\nimport { EnumType, strBody } from './sdkModels'\nimport type { IMappedType, CodeAssignment } from './codeGen'\nimport { CodeGen, trimInputs } from './codeGen'\n\nexport class PythonGen extends CodeGen {\n codePath = './python/'\n packagePath = 'looker_sdk'\n itself = 'self'\n fileExtension = '.py'\n commentStr = '# '\n nullStr = 'None'\n\n indentStr = ' '\n argDelimiter = `,\\n${this.indentStr.repeat(3)}`\n argSetSep = '='\n paramDelimiter = ',\\n'\n propDelimiter = '\\n'\n dataStructureDelimiter = ', '\n enumDelimiter = '\\n'\n codeQuote = '\"'\n typeOpen = '('\n typeClose = ')'\n hashKeyQuote = '\"'\n useModelClassForTypes = true\n\n endTypeStr = ''\n\n // keyword.kwlist\n pythonKeywords = new Set<string>([\n 'False',\n 'None',\n 'True',\n 'and',\n 'as',\n 'assert',\n 'async',\n 'await',\n 'break',\n 'class',\n 'continue',\n 'def',\n 'del',\n 'elif',\n 'else',\n 'except',\n 'finally',\n 'for',\n 'from',\n 'global',\n 'if',\n 'import',\n 'in',\n 'is',\n 'lambda',\n 'nonlocal',\n 'not',\n 'or',\n 'pass',\n 'raise',\n 'return',\n 'try',\n 'while',\n 'with',\n 'yield',\n ])\n\n // cattrs [un]structure hooks for model [de]serialization\n hooks: string[] = []\n structureHookFR = 'forward_ref_structure_hook'\n structureHookTK = 'translate_keys_structure_hook'\n pythonReservedKeywordClasses: Set<string> = new Set()\n\n methodsPrologue = (_indent: string) => `\n# ${this.warnEditing()}\nimport datetime\nfrom typing import Any, MutableMapping, Optional, Sequence, Union, cast\nimport warnings\n\nfrom . import models as mdls\nfrom ${this.packagePath}.rtl import api_methods\nfrom ${this.packagePath}.rtl import transport\n\nclass ${this.packageName}(api_methods.APIMethods):\n`\n\n methodsEpilogue = (_indent: string) =>\n this.apiVersion === '3.1' ? `LookerSDK = ${this.packageName}` : ''\n\n modelsPrologue = (_indent: string) => `\n# ${this.warnEditing()}\nimport datetime\nimport enum\nfrom typing import Any, MutableMapping, Optional, Sequence\n\ntry:\n from typing import ForwardRef # type: ignore\nexcept ImportError:\n from typing import _ForwardRef as ForwardRef # type: ignore\n\nimport attr\n\nfrom ${this.packagePath}.rtl import model\nfrom ${this.packagePath}.rtl import serialize as sr\n\nEXPLICIT_NULL = model.EXPLICIT_NULL # type: ignore\nDelimSequence = model.DelimSequence\n`\n\n modelsEpilogue = (_indent: string) => `\n\n# The following cattrs structure hook registrations are a workaround\n# for https://github.com/Tinche/cattrs/pull/42 Once this issue is resolved\n# these calls will be removed.\n\nimport functools # noqa:E402\n\n${\n this.structureHookFR\n} = functools.partial(sr.forward_ref_structure_hook, globals(), sr.converter${\n this.apiRef\n })\n${\n this.structureHookTK\n} = functools.partial(sr.translate_keys_structure_hook, sr.converter${\n this.apiRef\n })\n${this.hooks.join('\\n')}\n`\n\n sdkFileName(baseFileName: string) {\n return this.fileName(`sdk/api${this.apiRef}/${baseFileName}`)\n }\n\n argGroup(_indent: string, args: Arg[]) {\n if (!args || args.length === 0) return this.nullStr\n const hash: string[] = []\n for (const arg of args) {\n hash.push(`\"${arg}\": ${arg}`)\n }\n return `{${hash.join(this.dataStructureDelimiter)}}`\n }\n\n beginRegion(indent: string, description: string): string {\n // Sadly, Black reformats this to \"# region\" and IntelliJ doesn't recognize it either way\n return `${indent}#region ${description}`\n }\n\n endRegion(indent: string, _description: string): string {\n // Sadly, Black reformats this to \"# endregion\" and IntelliJ doesn't recognize it either way\n return `${indent}#endregion`\n }\n\n declareProperty(indent: string, property: IProperty, annotations = false) {\n const mappedType = this.typeMapModels(property.type)\n let propName = property.name\n if (this.pythonKeywords.has(propName)) {\n propName = propName + '_'\n }\n let propType = mappedType.name\n if (!property.required) {\n propType = `Optional[${mappedType.name}]`\n }\n\n let propDef\n if (annotations) {\n let annotation = propType\n if (this.isBareForwardRef(property)) {\n annotation = `ForwardRef(${propType})`\n }\n propDef = `${this.bumper(indent)}\"${propName}\": ${annotation}`\n } else {\n if (!property.required) {\n propType += ` = ${this.nullStr}`\n }\n propDef = `${indent}${propName}: ${propType}`\n }\n return propDef\n }\n\n private methodReturnType(method: IMethod) {\n const type = this.typeMapMethods(method.type)\n let returnType = type.name\n if (method.responseIsBoth()) {\n returnType = `Union[${returnType}, bytes]`\n } else if (method.responseIsBinary()) {\n returnType = 'bytes'\n }\n return returnType\n }\n\n // because Python has named default parameters, Request types are not required like\n // they are for TypeScript\n methodSignature(indent: string, method: IMethod) {\n const returnType = this.methodReturnType(method)\n const bump = this.bumper(indent)\n const params: string[] = []\n const args = method.allParams\n if (args && args.length > 0) {\n method.allParams.forEach((p) =>\n params.push(this.declareParameter(bump, method, p))\n )\n }\n let head = method.description?.trim()\n head =\n (head ? `${head}\\n\\n` : '') +\n `${method.httpMethod} ${method.endpoint} -> ${returnType}`\n params.push(\n `${bump}transport_options: Optional[transport.TransportOptions] = None,`\n )\n return (\n this.commentHeader(indent, head) +\n `${indent}def ${method.name}(\\n` +\n `${bump}self${params.length > 0 ? ',\\n' : ''}` +\n `${params.join(this.paramDelimiter)}\\n` +\n `${indent}) -> ${returnType}:\\n`\n )\n }\n\n declareParameter(indent: string, method: IMethod, param: IParameter) {\n let type: IType\n if (param.location === strBody) {\n type = this.writeableType(param.type, method) || param.type\n } else {\n type = param.type\n }\n const mapped = this.typeMapMethods(type)\n const paramType = param.required ? mapped.name : `Optional[${mapped.name}]`\n return (\n this.commentHeader(indent, param.description) +\n `${indent}${param.name}: ${paramType}` +\n (param.required ? '' : ` = ${mapped.default}`)\n )\n }\n\n makeTheCall(method: IMethod, inputs: ArgValues): string {\n const origDelim = this.argDelimiter\n this.argDelimiter = `,\\n${this.indentStr}`\n inputs = trimInputs(inputs)\n const resp = `response = sdk.${method.name}(`\n const args = this.assignParams(method, inputs)\n this.argDelimiter = origDelim\n return `${resp}${args})`\n }\n\n initArg(indent: string, property: IProperty) {\n let propName = property.name\n if (this.pythonKeywords.has(propName)) {\n propName = propName + '_'\n }\n return `${indent}self.${propName} = ${propName}`\n }\n\n declareType(indent: string, type: IType) {\n let decl = super.declareType(indent, type)\n if (type instanceof EnumType) {\n const invalid =\n 'invalid_api_enum_value = \"invalid_api_enum_value\"' +\n '\\n\\n\\n# https://github.com/python/mypy/issues/2427' +\n `\\n${type.name}.__new__ = model.safe_enum__new__ # type: ignore`\n decl += `\\n${this.bumper(indent)}${invalid}`\n }\n return decl\n }\n\n typeProperties(type: IType) {\n return Object.values(type.requiredProperties).concat(\n Object.values(type.optionalProperties)\n )\n }\n\n private isBareForwardRef = (prop: IProperty) => {\n // contains a \"bare\" forward reference e.g. `result_format: \"ResultFormat\"`\n // so we need to emit the `__annotations__` property\n return (\n prop.required &&\n (prop.type.customType || prop.type instanceof EnumType) &&\n !['ArrayType', 'HashType', 'DelimArrayType'].includes(prop.type.className)\n )\n }\n\n /**\n * Ideally we'd rely on @attr.s to generate the constructor for us\n * However, neither Jedi (https://github.com/davidhalter/jedi-vim/issues/816)\n * nor microsoft/python-language-server\n * (https://github.com/microsoft/python-language-server/issues/399)\n * display good tooltips for these auto-generated __init__ methods. So for\n * now we'll generate them ourselves following the functionality of\n * @attr.s(kw_only=True) we'll only allow kw_args.\n */\n construct(indent: string, type: IType) {\n if (type instanceof EnumType) return ''\n indent = this.bumper(indent)\n const bump = this.bumper(indent)\n const annotations: string[] = []\n const args: string[] = []\n const inits: string[] = []\n this.typeProperties(type).forEach((prop) => {\n annotations.push(this.declareProperty(indent, prop, true))\n args.push(this.declareConstructorArg('', prop))\n inits.push(this.initArg(bump, prop))\n })\n let result = ''\n if (Object.values(type.properties).some(this.isBareForwardRef)) {\n result =\n `\\n${indent}__annotations__ = {\\n` +\n `${annotations.join(',\\n')}` +\n `\\n${indent}}`\n }\n result +=\n `\\n\\n${indent}def __init__(self, *${this.argDelimiter}` +\n `${args.join(this.argDelimiter)}):\\n` +\n inits.join('\\n')\n return result\n }\n\n declareConstructorArg(indent: string, property: IProperty) {\n const mappedType = this.typeMapModels(property.type)\n let propType: string\n if (property.required) {\n propType = mappedType.name\n } else {\n propType = `Optional[${mappedType.name}] = ${this.nullStr}`\n }\n let propName = property.name\n if (this.pythonKeywords.has(propName)) {\n propName = propName + '_'\n }\n return `${indent}${propName}: ${propType}`\n }\n\n // this is a builder function to produce arguments with optional null place holders but no extra required optional arguments\n argFill(current: string, args: string): string {\n if (!current && args.trim() === this.nullStr) {\n // Don't append trailing optional arguments if none have been set yet\n return ''\n }\n let delimiter = ',\\n'\n if (!current) {\n delimiter = ''\n // Caller manually inserted delimiter followed by inline comment\n } else if (args.match(/, {2}#/)) {\n delimiter = delimiter.replace(',', '')\n }\n return `${args}${delimiter}${current}`\n }\n\n httpArgs(callerIndent: string, method: IMethod): string {\n const currIndent = this.bumper(callerIndent)\n let args = ''\n args = this.argFill(\n args,\n `${currIndent}transport_options=transport_options`\n )\n if (method.bodyArg) {\n args = this.argFill(args, `${currIndent}body=${method.bodyArg}`)\n }\n if (method.queryArgs.length) {\n const queryParams = this.argGroup('', method.queryArgs)\n args = this.argFill(args, `${currIndent}query_params=${queryParams}`)\n }\n let returnType = this.methodReturnType(method)\n if (method.responseIsBoth()) {\n // cattrs needs the python object Union[<rt>, bytes] in order\n // to properly deserialize the response. However, this argument\n // is passed as a value so we get a mypy error that the argument\n // has type \"object\" instead of TStructure. Hence the # type: ignore\n returnType += ', # type: ignore'\n }\n args = this.argFill(args, `${currIndent}structure=${returnType}`)\n let endpoint = `\"${method.endpoint}\"`\n if (/\\{\\w+\\}/.test(endpoint)) {\n // avoid flake8: f-string is missing placeholders\n endpoint = `f${endpoint}`\n }\n args = this.argFill(args, `${currIndent}path=${endpoint}`)\n return args\n }\n\n httpCall(callerIndent: string, method: IMethod): string {\n // callOpener itself is nested inside a cast()\n const currIndent = this.bumper(callerIndent)\n let deprecation = ''\n if (method.name === 'login_user') {\n deprecation =\n `${callerIndent}warnings.warn(\"login_user behavior changed significantly ` +\n `in 21.4.0. See https://git.io/JOtH1\")\\n`\n }\n const callOpener =\n `${callerIndent}response = cast(\\n` +\n `${currIndent}${this.methodReturnType(method)},\\n` +\n `${currIndent}${this.it(method.httpMethod.toLowerCase())}(\\n`\n const callArgs = `${this.httpArgs(currIndent, method)}\\n`\n const callCloser = `${currIndent})\\n${callerIndent})\\n`\n const returnStmt = `${callerIndent}return response`\n return deprecation + callOpener + callArgs + callCloser + returnStmt\n }\n\n encodePathParams(indent: string, method: IMethod) {\n let encodings = ''\n const pathParams = method.pathParams\n if (pathParams.length > 0) {\n for (const param of pathParams) {\n if (param.doEncode()) {\n encodings += `${indent}${param.name} = self.encode_path_param(${param.name})\\n`\n }\n }\n }\n return encodings\n }\n\n declareMethod(indent: string, method: IMethod) {\n const bump = this.bumper(indent)\n\n return (\n this.methodSignature(indent, method) +\n this.summary(bump, method.summary) +\n this.encodePathParams(bump, method) +\n this.httpCall(bump, method)\n )\n }\n\n typeSignature(indent: string, type: IType) {\n const bump = this.bumper(indent)\n const b2 = this.bumper(bump)\n const attrs: string[] = []\n const isEnum = type instanceof EnumType\n const baseClass = isEnum ? 'enum.Enum' : 'model.Model'\n let usesReservedPythonKeyword = false\n\n if (!isEnum) {\n for (const prop of this.typeProperties(type)) {\n let propName = prop.name\n if (this.pythonKeywords.has(propName)) {\n propName = propName + '_'\n usesReservedPythonKeyword = true\n }\n let attr = `${b2}${propName}:`\n if (prop.description) {\n attr += ` ${prop.description}`\n }\n attrs.push(attr)\n }\n }\n\n const forwardRef = `ForwardRef(\"${type.name}\")`\n this.hooks.push(\n `sr.converter${this.apiRef}.register_structure_hook(\\n${bump}${forwardRef}, # type: ignore\\n${bump}${this.structureHookFR} # type:ignore\\n)`\n )\n if (usesReservedPythonKeyword) {\n this.hooks.push(\n `sr.converter${this.apiRef}.register_structure_hook(\\n${bump}${type.name}, # type: ignore\\n${bump}${this.structureHookTK} # type:ignore\\n)`\n )\n }\n\n let result =\n `\\n` +\n (isEnum ? '' : `${indent}@attr.s(auto_attribs=True, init=False)\\n`) +\n `${indent}class ${type.name}(${baseClass}):\\n` +\n `${bump}\"\"\"\\n` +\n (type.description ? `${bump}${type.description}\\n\\n` : '')\n\n if (attrs.length > 0) {\n result += `${bump}Attributes:\\n` + `${attrs.join('\\n')}\\n`\n }\n\n return result + `${bump}\"\"\"\\n`\n }\n\n summary(indent: string, text: string | undefined) {\n return text ? `${indent}\"\"\"${text}\"\"\"\\n` : ''\n }\n\n // when format is \"methods\" that means we're in the methods.py module\n // and we need to reference the type by the `mdls.` package name\n prefixModelsNamespace(\n name: string,\n format: 'models' | 'methods',\n forwardRef = false\n ): string {\n if (format === 'models') {\n // need to quote this forwardRef\n name = forwardRef ? `\"${name}\"` : name\n } else if (format === 'methods') {\n name = `mdls.${name}`\n }\n return name\n }\n\n // hack default format to 'methods' so that argValue() calls the right thing\n typeMap(type: IType, format: 'models' | 'methods' = 'methods'): IMappedType {\n const asString: CodeAssignment = (_, v) => `\"${v}\"`\n const pythonTypes: Record<string, IMappedType> = {\n any: { default: this.nullStr, name: 'Any' },\n boolean: { default: this.nullStr, name: 'bool' },\n byte: { default: this.nullStr, name: 'bytes' },\n datetime: { default: this.nullStr, name: 'datetime.datetime' },\n double: { default: this.nullStr, name: 'float' },\n float: { default: this.nullStr, name: 'float' },\n int32: { default: this.nullStr, name: 'int' },\n int64: { default: this.nullStr, name: 'int' },\n integer: { default: this.nullStr, name: 'int' },\n number: { default: this.nullStr, name: 'float' },\n password: { default: this.nullStr, name: 'str', asVal: asString },\n string: { default: this.nullStr, name: 'str', asVal: asString },\n uri: { default: this.nullStr, name: 'str', asVal: asString },\n void: { default: this.nullStr, name: 'None' },\n }\n\n super.typeMap(type)\n if (type.elementType) {\n const map = this.typeMap(type.elementType, format)\n let typeName: string\n let name: string\n const defaultValue = this.nullStr\n let asVal: CodeAssignment | undefined\n switch (type.className) {\n case 'ArrayType':\n typeName = 'Sequence'\n name = `${typeName}[${map.name}]`\n break\n case 'HashType':\n typeName = 'MutableMapping'\n // TODO fix bad API spec, like MergeQuery vis_config\n name =\n typeName +\n '[str, ' +\n (type.elementType.name === 'string' ? 'Any' : map.name) +\n ']'\n break\n case 'DelimArrayType':\n typeName = this.prefixModelsNamespace('DelimSequence', format)\n name = `${typeName}[${map.name}]`\n asVal = (_, v) => `${typeName}([${v}])`\n break\n case 'EnumType':\n name = typeName = this.prefixModelsNamespace(type.name, format, true)\n asVal = (_, v) => `${typeName}.${v}`\n break\n default:\n throw new Error(`Don't know how to handle: ${JSON.stringify(type)}`)\n }\n const mt: IMappedType = { default: defaultValue, name: name }\n if (asVal) {\n mt.asVal = asVal\n }\n return mt\n }\n if (!type.name) {\n throw new Error('Cannot output a nameless type.')\n }\n const name = this.prefixModelsNamespace(\n type.name,\n format,\n !!type.customType\n )\n const result = pythonTypes[type.name]\n return result || { default: this.nullStr, name: name }\n }\n\n typeMapMethods(type: IType) {\n return this.typeMap(type, 'methods')\n }\n\n typeMapModels(type: IType) {\n return this.typeMap(type, 'models')\n }\n}\n"],"file":"python.gen.js"}
1
+ {"version":3,"sources":["../../src/python.gen.ts"],"names":["EnumType","strBody","CodeGen","trimInputs","PythonGen","indentStr","repeat","Set","_indent","warnEditing","packagePath","packageName","apiVersion","structureHookFR","apiRef","structureHookTK","hooks","join","prop","required","type","customType","includes","className","sdkFileName","baseFileName","fileName","argGroup","args","length","nullStr","hash","arg","push","dataStructureDelimiter","beginRegion","indent","description","endRegion","_description","declareProperty","property","annotations","mappedType","typeMapModels","propName","name","pythonKeywords","has","propType","propDef","annotation","isBareForwardRef","bumper","methodReturnType","method","typeMapMethods","returnType","responseIsBoth","responseIsBinary","methodSignature","bump","params","allParams","forEach","p","declareParameter","head","trim","httpMethod","endpoint","commentHeader","paramDelimiter","param","location","writeableType","mapped","paramType","default","makeTheCall","inputs","origDelim","argDelimiter","resp","assignParams","initArg","declareType","decl","invalid","typeProperties","Object","values","requiredProperties","concat","optionalProperties","construct","inits","declareConstructorArg","result","properties","some","argFill","current","delimiter","match","replace","httpArgs","callerIndent","currIndent","bodyArg","queryArgs","queryParams","test","httpCall","deprecation","callOpener","it","toLowerCase","callArgs","callCloser","returnStmt","encodePathParams","encodings","pathParams","doEncode","declareMethod","summary","typeSignature","b2","attrs","isEnum","baseClass","usesReservedPythonKeyword","attr","forwardRef","text","prefixModelsNamespace","format","typeMap","asString","_","v","pythonTypes","any","boolean","byte","datetime","double","float","int32","int64","integer","number","password","asVal","string","object","uri","void","elementType","map","typeName","defaultValue","Error","JSON","stringify","mt"],"mappings":";;AAkCA,SAASA,QAAT,EAAmBC,OAAnB,QAAkC,aAAlC;AAEA,SAASC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qBAAL,CAA2BpH,IAAI,CAAC0B,IAAhC,EAAsC2F,MAAtC,EAA8C,IAA9C,CAAlB;;AACAiB,UAAAA,KAAK,GAAG,CAACd,CAAD,EAAIC,CAAJ,eAAaoB,QAAb,cAAyBpB,CAAzB,CAAR;;AACA;;AACF;AACE,gBAAM,IAAIsB,KAAJ,qCAAuCC,IAAI,CAACC,SAAL,CAAejJ,IAAf,CAAvC,EAAN;AAxBJ;;AA0BA,UAAMkJ,EAAe,GAAG;AAAExF,QAAAA,OAAO,EAAEoF,YAAX;AAAyBpH,QAAAA,IAAI,EAAEA;AAA/B,OAAxB;;AACA,UAAI4G,KAAJ,EAAW;AACTY,QAAAA,EAAE,CAACZ,KAAH,GAAWA,KAAX;AACD;;AACD,aAAOY,EAAP;AACD;;AACD,QAAI,CAAClJ,IAAI,CAAC0B,IAAV,EAAgB;AACd,YAAM,IAAIqH,KAAJ,CAAU,gCAAV,CAAN;AACD;;AACD,QAAMrH,IAAI,GAAG,KAAK0F,qBAAL,CACXpH,IAAI,CAAC0B,IADM,EAEX2F,MAFW,EAGX,CAAC,CAACrH,IAAI,CAACC,UAHI,CAAb;AAKA,QAAM6E,MAAM,GAAG4C,WAAW,CAAC1H,IAAI,CAAC0B,IAAN,CAA1B;AACA,WAAOoD,MAAM,IAAI;AAAEpB,MAAAA,OAAO,EAAE,KAAKhD,OAAhB;AAAyBgB,MAAAA,IAAI,EAAEA;AAA/B,KAAjB;AACD;;AAEDU,EAAAA,cAAc,CAACpC,IAAD,EAAc;AAC1B,WAAO,KAAKsH,OAAL,CAAatH,IAAb,EAAmB,SAAnB,CAAP;AACD;;AAEDwB,EAAAA,aAAa,CAACxB,IAAD,EAAc;AACzB,WAAO,KAAKsH,OAAL,CAAatH,IAAb,EAAmB,QAAnB,CAAP;AACD;;AAljBoC","sourcesContent":["/*\n\n MIT License\n\n Copyright (c) 2021 Looker Data Sciences, Inc.\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n\n */\n\nimport type {\n Arg,\n ArgValues,\n IMethod,\n IParameter,\n IProperty,\n IType,\n} from './sdkModels'\nimport { EnumType, strBody } from './sdkModels'\nimport type { IMappedType, CodeAssignment } from './codeGen'\nimport { CodeGen, trimInputs } from './codeGen'\n\nexport class PythonGen extends CodeGen {\n codePath = './python/'\n packagePath = 'looker_sdk'\n itself = 'self'\n fileExtension = '.py'\n commentStr = '# '\n nullStr = 'None'\n\n indentStr = ' '\n argDelimiter = `,\\n${this.indentStr.repeat(3)}`\n argSetSep = '='\n paramDelimiter = ',\\n'\n propDelimiter = '\\n'\n dataStructureDelimiter = ', '\n enumDelimiter = '\\n'\n codeQuote = '\"'\n typeOpen = '('\n typeClose = ')'\n hashKeyQuote = '\"'\n useModelClassForTypes = true\n\n endTypeStr = ''\n\n // keyword.kwlist\n pythonKeywords = new Set<string>([\n 'False',\n 'None',\n 'True',\n 'and',\n 'as',\n 'assert',\n 'async',\n 'await',\n 'break',\n 'class',\n 'continue',\n 'def',\n 'del',\n 'elif',\n 'else',\n 'except',\n 'finally',\n 'for',\n 'from',\n 'global',\n 'if',\n 'import',\n 'in',\n 'is',\n 'lambda',\n 'nonlocal',\n 'not',\n 'or',\n 'pass',\n 'raise',\n 'return',\n 'try',\n 'while',\n 'with',\n 'yield',\n ])\n\n // cattrs [un]structure hooks for model [de]serialization\n hooks: string[] = []\n structureHookFR = 'forward_ref_structure_hook'\n structureHookTK = 'translate_keys_structure_hook'\n pythonReservedKeywordClasses: Set<string> = new Set()\n\n methodsPrologue = (_indent: string) => `\n# ${this.warnEditing()}\nimport datetime\nfrom typing import Any, MutableMapping, Optional, Sequence, Union, cast\nimport warnings\n\nfrom . import models as mdls\nfrom ${this.packagePath}.rtl import api_methods\nfrom ${this.packagePath}.rtl import transport\n\nclass ${this.packageName}(api_methods.APIMethods):\n`\n\n methodsEpilogue = (_indent: string) =>\n this.apiVersion === '3.1' ? `LookerSDK = ${this.packageName}` : ''\n\n modelsPrologue = (_indent: string) => `\n# ${this.warnEditing()}\nimport datetime\nimport enum\nfrom typing import Any, MutableMapping, Optional, Sequence\n\ntry:\n from typing import ForwardRef # type: ignore\nexcept ImportError:\n from typing import _ForwardRef as ForwardRef # type: ignore\n\nimport attr\n\nfrom ${this.packagePath}.rtl import model\nfrom ${this.packagePath}.rtl import serialize as sr\n\nEXPLICIT_NULL = model.EXPLICIT_NULL # type: ignore\nDelimSequence = model.DelimSequence\n`\n\n modelsEpilogue = (_indent: string) => `\n\n# The following cattrs structure hook registrations are a workaround\n# for https://github.com/Tinche/cattrs/pull/42 Once this issue is resolved\n# these calls will be removed.\n\nimport functools # noqa:E402\n\n${\n this.structureHookFR\n} = functools.partial(sr.forward_ref_structure_hook, globals(), sr.converter${\n this.apiRef\n })\n${\n this.structureHookTK\n} = functools.partial(sr.translate_keys_structure_hook, sr.converter${\n this.apiRef\n })\n${this.hooks.join('\\n')}\n`\n\n sdkFileName(baseFileName: string) {\n return this.fileName(`sdk/api${this.apiRef}/${baseFileName}`)\n }\n\n argGroup(_indent: string, args: Arg[]) {\n if (!args || args.length === 0) return this.nullStr\n const hash: string[] = []\n for (const arg of args) {\n hash.push(`\"${arg}\": ${arg}`)\n }\n return `{${hash.join(this.dataStructureDelimiter)}}`\n }\n\n beginRegion(indent: string, description: string): string {\n // Sadly, Black reformats this to \"# region\" and IntelliJ doesn't recognize it either way\n return `${indent}#region ${description}`\n }\n\n endRegion(indent: string, _description: string): string {\n // Sadly, Black reformats this to \"# endregion\" and IntelliJ doesn't recognize it either way\n return `${indent}#endregion`\n }\n\n declareProperty(indent: string, property: IProperty, annotations = false) {\n const mappedType = this.typeMapModels(property.type)\n let propName = property.name\n if (this.pythonKeywords.has(propName)) {\n propName = propName + '_'\n }\n let propType = mappedType.name\n if (!property.required) {\n propType = `Optional[${mappedType.name}]`\n }\n\n let propDef\n if (annotations) {\n let annotation = propType\n if (this.isBareForwardRef(property)) {\n annotation = `ForwardRef(${propType})`\n }\n propDef = `${this.bumper(indent)}\"${propName}\": ${annotation}`\n } else {\n if (!property.required) {\n propType += ` = ${this.nullStr}`\n }\n propDef = `${indent}${propName}: ${propType}`\n }\n return propDef\n }\n\n private methodReturnType(method: IMethod) {\n const type = this.typeMapMethods(method.type)\n let returnType = type.name\n if (method.responseIsBoth()) {\n returnType = `Union[${returnType}, bytes]`\n } else if (method.responseIsBinary()) {\n returnType = 'bytes'\n }\n return returnType\n }\n\n // because Python has named default parameters, Request types are not required like\n // they are for TypeScript\n methodSignature(indent: string, method: IMethod) {\n const returnType = this.methodReturnType(method)\n const bump = this.bumper(indent)\n const params: string[] = []\n const args = method.allParams\n if (args && args.length > 0) {\n method.allParams.forEach((p) =>\n params.push(this.declareParameter(bump, method, p))\n )\n }\n let head = method.description?.trim()\n head =\n (head ? `${head}\\n\\n` : '') +\n `${method.httpMethod} ${method.endpoint} -> ${returnType}`\n params.push(\n `${bump}transport_options: Optional[transport.TransportOptions] = None,`\n )\n return (\n this.commentHeader(indent, head) +\n `${indent}def ${method.name}(\\n` +\n `${bump}self${params.length > 0 ? ',\\n' : ''}` +\n `${params.join(this.paramDelimiter)}\\n` +\n `${indent}) -> ${returnType}:\\n`\n )\n }\n\n declareParameter(indent: string, method: IMethod, param: IParameter) {\n let type: IType\n if (param.location === strBody) {\n type = this.writeableType(param.type, method) || param.type\n } else {\n type = param.type\n }\n const mapped = this.typeMapMethods(type)\n const paramType = param.required ? mapped.name : `Optional[${mapped.name}]`\n return (\n this.commentHeader(indent, param.description) +\n `${indent}${param.name}: ${paramType}` +\n (param.required ? '' : ` = ${mapped.default}`)\n )\n }\n\n makeTheCall(method: IMethod, inputs: ArgValues): string {\n const origDelim = this.argDelimiter\n this.argDelimiter = `,\\n${this.indentStr}`\n inputs = trimInputs(inputs)\n const resp = `response = sdk.${method.name}(`\n const args = this.assignParams(method, inputs)\n this.argDelimiter = origDelim\n return `${resp}${args})`\n }\n\n initArg(indent: string, property: IProperty) {\n let propName = property.name\n if (this.pythonKeywords.has(propName)) {\n propName = propName + '_'\n }\n return `${indent}self.${propName} = ${propName}`\n }\n\n declareType(indent: string, type: IType) {\n let decl = super.declareType(indent, type)\n if (type instanceof EnumType) {\n const invalid =\n 'invalid_api_enum_value = \"invalid_api_enum_value\"' +\n '\\n\\n\\n# https://github.com/python/mypy/issues/2427' +\n `\\n${type.name}.__new__ = model.safe_enum__new__ # type: ignore`\n decl += `\\n${this.bumper(indent)}${invalid}`\n }\n return decl\n }\n\n typeProperties(type: IType) {\n return Object.values(type.requiredProperties).concat(\n Object.values(type.optionalProperties)\n )\n }\n\n private isBareForwardRef = (prop: IProperty) => {\n // contains a \"bare\" forward reference e.g. `result_format: \"ResultFormat\"`\n // so we need to emit the `__annotations__` property\n return (\n prop.required &&\n (prop.type.customType || prop.type instanceof EnumType) &&\n !['ArrayType', 'HashType', 'DelimArrayType'].includes(prop.type.className)\n )\n }\n\n /**\n * Ideally we'd rely on @attr.s to generate the constructor for us\n * However, neither Jedi (https://github.com/davidhalter/jedi-vim/issues/816)\n * nor microsoft/python-language-server\n * (https://github.com/microsoft/python-language-server/issues/399)\n * display good tooltips for these auto-generated __init__ methods. So for\n * now we'll generate them ourselves following the functionality of\n * @attr.s(kw_only=True) we'll only allow kw_args.\n */\n construct(indent: string, type: IType) {\n if (type instanceof EnumType) return ''\n indent = this.bumper(indent)\n const bump = this.bumper(indent)\n const annotations: string[] = []\n const args: string[] = []\n const inits: string[] = []\n this.typeProperties(type).forEach((prop) => {\n annotations.push(this.declareProperty(indent, prop, true))\n args.push(this.declareConstructorArg('', prop))\n inits.push(this.initArg(bump, prop))\n })\n let result = ''\n if (Object.values(type.properties).some(this.isBareForwardRef)) {\n result =\n `\\n${indent}__annotations__ = {\\n` +\n `${annotations.join(',\\n')}` +\n `\\n${indent}}`\n }\n result +=\n `\\n\\n${indent}def __init__(self, *${this.argDelimiter}` +\n `${args.join(this.argDelimiter)}):\\n` +\n inits.join('\\n')\n return result\n }\n\n declareConstructorArg(indent: string, property: IProperty) {\n const mappedType = this.typeMapModels(property.type)\n let propType: string\n if (property.required) {\n propType = mappedType.name\n } else {\n propType = `Optional[${mappedType.name}] = ${this.nullStr}`\n }\n let propName = property.name\n if (this.pythonKeywords.has(propName)) {\n propName = propName + '_'\n }\n return `${indent}${propName}: ${propType}`\n }\n\n // this is a builder function to produce arguments with optional null place holders but no extra required optional arguments\n argFill(current: string, args: string): string {\n if (!current && args.trim() === this.nullStr) {\n // Don't append trailing optional arguments if none have been set yet\n return ''\n }\n let delimiter = ',\\n'\n if (!current) {\n delimiter = ''\n // Caller manually inserted delimiter followed by inline comment\n } else if (args.match(/, {2}#/)) {\n delimiter = delimiter.replace(',', '')\n }\n return `${args}${delimiter}${current}`\n }\n\n httpArgs(callerIndent: string, method: IMethod): string {\n const currIndent = this.bumper(callerIndent)\n let args = ''\n args = this.argFill(\n args,\n `${currIndent}transport_options=transport_options`\n )\n if (method.bodyArg) {\n args = this.argFill(args, `${currIndent}body=${method.bodyArg}`)\n }\n if (method.queryArgs.length) {\n const queryParams = this.argGroup('', method.queryArgs)\n args = this.argFill(args, `${currIndent}query_params=${queryParams}`)\n }\n let returnType = this.methodReturnType(method)\n if (method.responseIsBoth()) {\n // cattrs needs the python object Union[<rt>, bytes] in order\n // to properly deserialize the response. However, this argument\n // is passed as a value so we get a mypy error that the argument\n // has type \"object\" instead of TStructure. Hence the # type: ignore\n returnType += ', # type: ignore'\n }\n args = this.argFill(args, `${currIndent}structure=${returnType}`)\n let endpoint = `\"${method.endpoint}\"`\n if (/\\{\\w+\\}/.test(endpoint)) {\n // avoid flake8: f-string is missing placeholders\n endpoint = `f${endpoint}`\n }\n args = this.argFill(args, `${currIndent}path=${endpoint}`)\n return args\n }\n\n httpCall(callerIndent: string, method: IMethod): string {\n // callOpener itself is nested inside a cast()\n const currIndent = this.bumper(callerIndent)\n let deprecation = ''\n if (method.name === 'login_user') {\n deprecation =\n `${callerIndent}warnings.warn(\"login_user behavior changed significantly ` +\n `in 21.4.0. See https://git.io/JOtH1\")\\n`\n }\n const callOpener =\n `${callerIndent}response = cast(\\n` +\n `${currIndent}${this.methodReturnType(method)},\\n` +\n `${currIndent}${this.it(method.httpMethod.toLowerCase())}(\\n`\n const callArgs = `${this.httpArgs(currIndent, method)}\\n`\n const callCloser = `${currIndent})\\n${callerIndent})\\n`\n const returnStmt = `${callerIndent}return response`\n return deprecation + callOpener + callArgs + callCloser + returnStmt\n }\n\n encodePathParams(indent: string, method: IMethod) {\n let encodings = ''\n const pathParams = method.pathParams\n if (pathParams.length > 0) {\n for (const param of pathParams) {\n if (param.doEncode()) {\n encodings += `${indent}${param.name} = self.encode_path_param(${param.name})\\n`\n }\n }\n }\n return encodings\n }\n\n declareMethod(indent: string, method: IMethod) {\n const bump = this.bumper(indent)\n\n return (\n this.methodSignature(indent, method) +\n this.summary(bump, method.summary) +\n this.encodePathParams(bump, method) +\n this.httpCall(bump, method)\n )\n }\n\n typeSignature(indent: string, type: IType) {\n const bump = this.bumper(indent)\n const b2 = this.bumper(bump)\n const attrs: string[] = []\n const isEnum = type instanceof EnumType\n const baseClass = isEnum ? 'enum.Enum' : 'model.Model'\n let usesReservedPythonKeyword = false\n\n if (!isEnum) {\n for (const prop of this.typeProperties(type)) {\n let propName = prop.name\n if (this.pythonKeywords.has(propName)) {\n propName = propName + '_'\n usesReservedPythonKeyword = true\n }\n let attr = `${b2}${propName}:`\n if (prop.description) {\n attr += ` ${prop.description}`\n }\n attrs.push(attr)\n }\n }\n\n const forwardRef = `ForwardRef(\"${type.name}\")`\n this.hooks.push(\n `sr.converter${this.apiRef}.register_structure_hook(\\n${bump}${forwardRef}, # type: ignore\\n${bump}${this.structureHookFR} # type:ignore\\n)`\n )\n if (usesReservedPythonKeyword) {\n this.hooks.push(\n `sr.converter${this.apiRef}.register_structure_hook(\\n${bump}${type.name}, # type: ignore\\n${bump}${this.structureHookTK} # type:ignore\\n)`\n )\n }\n\n let result =\n `\\n` +\n (isEnum ? '' : `${indent}@attr.s(auto_attribs=True, init=False)\\n`) +\n `${indent}class ${type.name}(${baseClass}):\\n` +\n `${bump}\"\"\"\\n` +\n (type.description ? `${bump}${type.description}\\n\\n` : '')\n\n if (attrs.length > 0) {\n result += `${bump}Attributes:\\n` + `${attrs.join('\\n')}\\n`\n }\n\n return result + `${bump}\"\"\"\\n`\n }\n\n summary(indent: string, text: string | undefined) {\n return text ? `${indent}\"\"\"${text}\"\"\"\\n` : ''\n }\n\n // when format is \"methods\" that means we're in the methods.py module\n // and we need to reference the type by the `mdls.` package name\n prefixModelsNamespace(\n name: string,\n format: 'models' | 'methods',\n forwardRef = false\n ): string {\n if (format === 'models') {\n // need to quote this forwardRef\n name = forwardRef ? `\"${name}\"` : name\n } else if (format === 'methods') {\n name = `mdls.${name}`\n }\n return name\n }\n\n // hack default format to 'methods' so that argValue() calls the right thing\n typeMap(type: IType, format: 'models' | 'methods' = 'methods'): IMappedType {\n const asString: CodeAssignment = (_, v) => `\"${v}\"`\n const pythonTypes: Record<string, IMappedType> = {\n any: { default: this.nullStr, name: 'Any' },\n boolean: { default: this.nullStr, name: 'bool' },\n byte: { default: this.nullStr, name: 'bytes' },\n datetime: { default: this.nullStr, name: 'datetime.datetime' },\n double: { default: this.nullStr, name: 'float' },\n float: { default: this.nullStr, name: 'float' },\n int32: { default: this.nullStr, name: 'int' },\n int64: { default: this.nullStr, name: 'int' },\n integer: { default: this.nullStr, name: 'int' },\n number: { default: this.nullStr, name: 'float' },\n password: { default: this.nullStr, name: 'str', asVal: asString },\n string: { default: this.nullStr, name: 'str', asVal: asString },\n object: { default: this.nullStr, name: 'str', asVal: asString },\n uri: { default: this.nullStr, name: 'str', asVal: asString },\n void: { default: this.nullStr, name: 'None' },\n }\n\n super.typeMap(type)\n if (type.elementType) {\n const map = this.typeMap(type.elementType, format)\n let typeName: string\n let name: string\n const defaultValue = this.nullStr\n let asVal: CodeAssignment | undefined\n switch (type.className) {\n case 'ArrayType':\n typeName = 'Sequence'\n name = `${typeName}[${map.name}]`\n break\n case 'HashType':\n typeName = 'MutableMapping'\n // TODO fix bad API spec, like MergeQuery vis_config\n name =\n typeName +\n '[str, ' +\n (type.elementType.name === 'string' ? 'Any' : map.name) +\n ']'\n break\n case 'DelimArrayType':\n typeName = this.prefixModelsNamespace('DelimSequence', format)\n name = `${typeName}[${map.name}]`\n asVal = (_, v) => `${typeName}([${v}])`\n break\n case 'EnumType':\n name = typeName = this.prefixModelsNamespace(type.name, format, true)\n asVal = (_, v) => `${typeName}.${v}`\n break\n default:\n throw new Error(`Don't know how to handle: ${JSON.stringify(type)}`)\n }\n const mt: IMappedType = { default: defaultValue, name: name }\n if (asVal) {\n mt.asVal = asVal\n }\n return mt\n }\n if (!type.name) {\n throw new Error('Cannot output a nameless type.')\n }\n const name = this.prefixModelsNamespace(\n type.name,\n format,\n !!type.customType\n )\n const result = pythonTypes[type.name]\n return result || { default: this.nullStr, name: name }\n }\n\n typeMapMethods(type: IType) {\n return this.typeMap(type, 'methods')\n }\n\n typeMapModels(type: IType) {\n return this.typeMap(type, 'models')\n }\n}\n"],"file":"python.gen.js"}
@@ -957,7 +957,7 @@ export class Type {
957
957
  load(api) {
958
958
  Object.entries(this.schema.properties || {}).forEach(_ref7 => {
959
959
  var [propName, propSchema] = _ref7;
960
- var propType = api.resolveType(propSchema, undefined, propName);
960
+ var propType = api.resolveType(propSchema, undefined, propName, this.name);
961
961
 
962
962
  if (propType.instanceOf('EnumType')) {
963
963
  api.registerEnum(propType, propName);
@@ -1069,7 +1069,7 @@ export class ArrayType extends Type {
1069
1069
 
1070
1070
  }
1071
1071
  export class EnumType extends Type {
1072
- constructor(elementType, schema, types, typeName, methodName) {
1072
+ constructor(elementType, schema, api, typeName, methodName) {
1073
1073
  super(schema, schema.name);
1074
1074
  this.elementType = elementType;
1075
1075
 
@@ -1086,27 +1086,36 @@ export class EnumType extends Type {
1086
1086
  }
1087
1087
 
1088
1088
  if (methodName) {
1089
- this.description = "Type defined in ".concat(methodName, "\n").concat(this.description);
1089
+ this.description = "".concat(this.description).concat(this.description ? ' ' : '', "(Enum defined in ").concat(methodName, ")");
1090
1090
  }
1091
1091
 
1092
- this.name = this.findName(types, typeName, methodName);
1092
+ this.name = this.findName(api, typeName, methodName);
1093
1093
  }
1094
1094
 
1095
- findName(types, typeName, methodName) {
1095
+ findName(api, typeName, methodName) {
1096
+ var hash = md5(this.asHashString());
1097
+ var enums = api.getEnumList();
1096
1098
  var name = titleCase(this.name || typeName || 'Enum');
1097
1099
 
1098
- if (name in types) {
1100
+ if (name in api.types) {
1101
+ var matched = enums[hash];
1102
+
1103
+ if ((matched === null || matched === void 0 ? void 0 : matched.name) === name) {
1104
+ return name;
1105
+ }
1106
+
1099
1107
  var baseName = methodName ? titleCase("".concat(methodName, "_").concat(name)) : name;
1100
1108
  var newName = baseName;
1101
1109
  var i = 0;
1102
1110
 
1103
- while (newName in types) {
1111
+ while (newName in api.types) {
1104
1112
  newName = "".concat(baseName).concat(++i);
1105
1113
  }
1106
1114
 
1107
1115
  name = newName;
1108
1116
  }
1109
1117
 
1118
+ enums[hash] = this;
1110
1119
  return name;
1111
1120
  }
1112
1121
 
@@ -1442,7 +1451,7 @@ export class ApiModel {
1442
1451
  }
1443
1452
 
1444
1453
  if (this.schemaHasEnums(schema)) {
1445
- var num = new EnumType(resolved, schema, this.types, typeName, methodName);
1454
+ var num = new EnumType(resolved, schema, this, typeName, methodName);
1446
1455
  this.registerEnum(num, methodName);
1447
1456
  var result = new ArrayType(num, schema);
1448
1457
  return result;
@@ -1452,7 +1461,9 @@ export class ApiModel {
1452
1461
  }
1453
1462
 
1454
1463
  if (this.schemaHasEnums(schema)) {
1455
- var _result = new EnumType(this.resolveType(schema.type), schema, this.types, typeName, methodName);
1464
+ var _resolved = this.resolveType(schema.type, style, typeName, methodName);
1465
+
1466
+ var _result = new EnumType(_resolved, schema, this, typeName, methodName);
1456
1467
 
1457
1468
  if (_result) {
1458
1469
  return this.registerEnum(_result, methodName);
@@ -1494,10 +1505,14 @@ export class ApiModel {
1494
1505
 
1495
1506
  registerEnum(type, methodName) {
1496
1507
  if (!(type instanceof EnumType)) return type;
1497
- var hash = md5(type.asHashString());
1498
1508
 
1499
- if (hash in this.enumTypes) {
1500
- return this.enumTypes[hash];
1509
+ if (type.name in this.types) {
1510
+ var hash = md5(type.asHashString());
1511
+ var matched = this.enumTypes[hash];
1512
+
1513
+ if ((matched === null || matched === void 0 ? void 0 : matched.name) === type.name) {
1514
+ return this.enumTypes[hash];
1515
+ }
1501
1516
  }
1502
1517
 
1503
1518
  if (methodName) {
@@ -1510,7 +1525,6 @@ export class ApiModel {
1510
1525
  }
1511
1526
  }
1512
1527
 
1513
- this.enumTypes[hash] = type;
1514
1528
  this.types[type.name] = type;
1515
1529
  return type;
1516
1530
  }
@@ -1532,6 +1546,10 @@ export class ApiModel {
1532
1546
  return result;
1533
1547
  }
1534
1548
 
1549
+ getEnumList() {
1550
+ return this.enumTypes;
1551
+ }
1552
+
1535
1553
  makeWriteableType(hash, type) {
1536
1554
  var writer = new WriteType(this, type);
1537
1555
  this.types[writer.name] = writer;