@looker/sdk-codegen 21.0.24 → 21.2.1
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 +76 -0
- package/lib/codeGen.d.ts +7 -5
- package/lib/codeGen.js +24 -13
- package/lib/codeGen.js.map +1 -1
- package/lib/codeGenerators.d.ts +2 -2
- package/lib/codeGenerators.js.map +1 -1
- package/lib/csharp.gen.d.ts +3 -2
- package/lib/csharp.gen.js.map +1 -1
- package/lib/declarationInfo.d.ts +2 -2
- package/lib/declarationInfo.js.map +1 -1
- package/lib/esm/codeGen.js +24 -13
- package/lib/esm/codeGen.js.map +1 -1
- package/lib/esm/codeGenerators.js.map +1 -1
- package/lib/esm/csharp.gen.js.map +1 -1
- package/lib/esm/declarationInfo.js.map +1 -1
- package/lib/esm/exampleInfo.js.map +1 -1
- package/lib/esm/go.gen.js.map +1 -1
- package/lib/esm/kotlin.gen.js +89 -9
- package/lib/esm/kotlin.gen.js.map +1 -1
- package/lib/esm/pseudo.gen.js.map +1 -1
- package/lib/esm/python.gen.js +2 -2
- package/lib/esm/python.gen.js.map +1 -1
- package/lib/esm/sdkModels.js +199 -71
- package/lib/esm/sdkModels.js.map +1 -1
- package/lib/esm/specConverter.js.map +1 -1
- package/lib/esm/specDiff.js +1 -1
- package/lib/esm/specDiff.js.map +1 -1
- package/lib/esm/swift.gen.js +60 -8
- package/lib/esm/swift.gen.js.map +1 -1
- package/lib/esm/typescript.gen.js +9 -9
- package/lib/esm/typescript.gen.js.map +1 -1
- package/lib/exampleInfo.d.ts +1 -1
- package/lib/exampleInfo.js.map +1 -1
- package/lib/go.gen.d.ts +3 -2
- package/lib/go.gen.js.map +1 -1
- package/lib/kotlin.gen.d.ts +16 -2
- package/lib/kotlin.gen.js +88 -8
- package/lib/kotlin.gen.js.map +1 -1
- package/lib/pseudo.gen.d.ts +1 -1
- package/lib/pseudo.gen.js.map +1 -1
- package/lib/python.gen.d.ts +3 -2
- package/lib/python.gen.js +2 -2
- package/lib/python.gen.js.map +1 -1
- package/lib/sdkModels.d.ts +20 -5
- package/lib/sdkModels.js +208 -74
- package/lib/sdkModels.js.map +1 -1
- package/lib/specConverter.d.ts +4 -2
- package/lib/specConverter.js.map +1 -1
- package/lib/specDiff.d.ts +1 -1
- package/lib/specDiff.js +1 -1
- package/lib/specDiff.js.map +1 -1
- package/lib/swift.gen.d.ts +6 -2
- package/lib/swift.gen.js +60 -8
- package/lib/swift.gen.js.map +1 -1
- package/lib/typescript.gen.d.ts +4 -2
- package/lib/typescript.gen.js +9 -9
- package/lib/typescript.gen.js.map +1 -1
- package/package.json +4 -4
package/lib/python.gen.js
CHANGED
|
@@ -63,7 +63,7 @@ class PythonGen extends _codeGen.CodeGen {
|
|
|
63
63
|
|
|
64
64
|
_defineProperty(this, "pythonReservedKeywordClasses", new Set());
|
|
65
65
|
|
|
66
|
-
_defineProperty(this, "methodsPrologue", _indent => "\n# ".concat(this.warnEditing(), "\nimport datetime\nfrom typing import Any, MutableMapping, Optional, Sequence, Union, cast\nimport warnings\n\nfrom . import models\nfrom ").concat(this.packagePath, ".rtl import api_methods\nfrom ").concat(this.packagePath, ".rtl import transport\n\nclass ").concat(this.packageName, "(api_methods.APIMethods):\n"));
|
|
66
|
+
_defineProperty(this, "methodsPrologue", _indent => "\n# ".concat(this.warnEditing(), "\nimport datetime\nfrom typing import Any, MutableMapping, Optional, Sequence, Union, cast\nimport warnings\n\nfrom . import models as mdls\nfrom ").concat(this.packagePath, ".rtl import api_methods\nfrom ").concat(this.packagePath, ".rtl import transport\n\nclass ").concat(this.packageName, "(api_methods.APIMethods):\n"));
|
|
67
67
|
|
|
68
68
|
_defineProperty(this, "methodsEpilogue", _indent => this.apiVersion === '3.1' ? "LookerSDK = ".concat(this.packageName) : '');
|
|
69
69
|
|
|
@@ -391,7 +391,7 @@ class PythonGen extends _codeGen.CodeGen {
|
|
|
391
391
|
if (format === 'models') {
|
|
392
392
|
name = forwardRef ? "\"".concat(name, "\"") : name;
|
|
393
393
|
} else if (format === 'methods') {
|
|
394
|
-
name = "
|
|
394
|
+
name = "mdls.".concat(name);
|
|
395
395
|
}
|
|
396
396
|
|
|
397
397
|
return name;
|
package/lib/python.gen.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/python.gen.ts"],"names":["PythonGen","CodeGen","indentStr","repeat","Set","_indent","warnEditing","packagePath","packageName","apiVersion","structureHookFR","apiRef","structureHookTK","hooks","join","prop","required","type","customType","EnumType","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","strBody","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":";;;;;;;AA0BA;;AAUA;;;;AAEO,MAAMA,SAAN,SAAwBC,gBAAxB,CAAgC;AAAA;AAAA;;AAAA,sCAC1B,WAD0B;;AAAA,yCAEvB,YAFuB;;AAAA,oCAG5B,MA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EAAEmF,YAAX;AAAyBpH,QAAAA,IAAI,EAAEA;AAA/B,OAAxB;;AACA,UAAI6G,KAAJ,EAAW;AACTW,QAAAA,EAAE,CAACX,KAAH,GAAWA,KAAX;AACD;;AACD,aAAOW,EAAP;AACD;;AACD,QAAI,CAACnJ,IAAI,CAAC2B,IAAV,EAAgB;AACd,YAAM,IAAIqH,KAAJ,CAAU,gCAAV,CAAN;AACD;;AACD,QAAMrH,IAAI,GAAG,KAAK2F,qBAAL,CACXtH,IAAI,CAAC2B,IADM,EAEX4F,MAFW,EAGX,CAAC,CAACvH,IAAI,CAACC,UAHI,CAAb;AAKA,QAAM+E,MAAM,GAAG4C,WAAW,CAAC5H,IAAI,CAAC2B,IAAN,CAA1B;AACA,WAAOqD,MAAM,IAAI;AAAEpB,MAAAA,OAAO,EAAE,KAAKjD,OAAhB;AAAyBgB,MAAAA,IAAI,EAAEA;AAA/B,KAAjB;AACD;;AAEDU,EAAAA,cAAc,CAACrC,IAAD,EAAc;AAC1B,WAAO,KAAKwH,OAAL,CAAaxH,IAAb,EAAmB,SAAnB,CAAP;AACD;;AAEDyB,EAAAA,aAAa,CAACzB,IAAD,EAAc;AACzB,WAAO,KAAKwH,OAAL,CAAaxH,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 {\n Arg,\n ArgValues,\n EnumType,\n IMethod,\n IParameter,\n IProperty,\n IType,\n strBody,\n} from './sdkModels'\nimport { CodeGen, IMappedType, CodeAssignment, 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\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 `models.` 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 = `models.${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":["PythonGen","CodeGen","indentStr","repeat","Set","_indent","warnEditing","packagePath","packageName","apiVersion","structureHookFR","apiRef","structureHookTK","hooks","join","prop","required","type","customType","EnumType","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","strBody","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;;AAEA;;;;AAEO,MAAMA,SAAN,SAAwBC,gBAAxB,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,KAAKC,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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CAACrC,IAAD,EAAc;AAC1B,WAAO,KAAKwH,OAAL,CAAaxH,IAAb,EAAmB,SAAnB,CAAP;AACD;;AAEDyB,EAAAA,aAAa,CAACzB,IAAD,EAAc;AACzB,WAAO,KAAKwH,OAAL,CAAaxH,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"}
|
package/lib/sdkModels.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as OAS from 'openapi3-ts';
|
|
2
|
-
import { HttpMethod
|
|
2
|
+
import type { HttpMethod } from '@looker/sdk-rtl';
|
|
3
|
+
import { ResponseMode } from '@looker/sdk-rtl';
|
|
3
4
|
export declare const strBody = "body";
|
|
4
5
|
export declare const strRequest = "Request";
|
|
5
6
|
export declare const strWrite = "Write";
|
|
@@ -50,13 +51,15 @@ export declare type KeyedCollection<T> = Record<string, T>;
|
|
|
50
51
|
export declare type MethodList = KeyedCollection<IMethod>;
|
|
51
52
|
export declare type TypeList = KeyedCollection<IType>;
|
|
52
53
|
export declare type TagList = KeyedCollection<MethodList>;
|
|
54
|
+
export declare type TypeTagList = KeyedCollection<TypeList>;
|
|
53
55
|
export declare type PropertyList = KeyedCollection<IProperty>;
|
|
54
56
|
export declare type KeyList = Set<string>;
|
|
55
57
|
export declare type EnumValueType = string | number;
|
|
56
|
-
export declare const keyValues: (
|
|
58
|
+
export declare const keyValues: (list: KeyList) => string[];
|
|
57
59
|
export declare const mayQuote: (value: any, quoteChar?: string) => string;
|
|
58
60
|
export declare const methodRefs: (api: IApiModel, refs: KeyList) => IMethod[];
|
|
59
61
|
export declare const typeRefs: (api: IApiModel, refs: KeyList) => IType[];
|
|
62
|
+
export declare const firstMethodRef: (api: ApiModel, type: IType, stack?: KeyList) => IMethod;
|
|
60
63
|
export interface ISymbolList {
|
|
61
64
|
methods: MethodList;
|
|
62
65
|
types: TypeList;
|
|
@@ -76,8 +79,8 @@ export declare enum SearchCriterion {
|
|
|
76
79
|
export declare type SearchCriterionTerm = keyof typeof SearchCriterion;
|
|
77
80
|
export declare type SearchCriteria = Set<SearchCriterion>;
|
|
78
81
|
export declare const SearchAll: SearchCriteria;
|
|
79
|
-
export declare const
|
|
80
|
-
export declare const
|
|
82
|
+
export declare const criteriaToSet: (criteria: string[]) => SearchCriteria;
|
|
83
|
+
export declare const setToCriteria: (criteria: SearchCriteria) => string[];
|
|
81
84
|
export interface ISearchResult {
|
|
82
85
|
ok: boolean;
|
|
83
86
|
tags: TagList;
|
|
@@ -87,6 +90,13 @@ export interface ISearchResult {
|
|
|
87
90
|
export interface ISymbolTable extends ISymbolList {
|
|
88
91
|
resolveType(schema: OAS.SchemaObject): IType;
|
|
89
92
|
}
|
|
93
|
+
export declare enum MetaType {
|
|
94
|
+
Intrinsic = "Intrinsic",
|
|
95
|
+
Specification = "Specification",
|
|
96
|
+
Write = "Write",
|
|
97
|
+
Request = "Request",
|
|
98
|
+
Enumerated = "Enumerated"
|
|
99
|
+
}
|
|
90
100
|
export interface IType extends ISymbol {
|
|
91
101
|
properties: PropertyList;
|
|
92
102
|
requiredProperties: PropertyList;
|
|
@@ -108,6 +118,7 @@ export interface IType extends ISymbol {
|
|
|
108
118
|
parentTypes: KeyList;
|
|
109
119
|
className: string;
|
|
110
120
|
intrinsic: boolean;
|
|
121
|
+
metaType: MetaType;
|
|
111
122
|
instanceOf(className: string): boolean;
|
|
112
123
|
asHashString(): string;
|
|
113
124
|
isRecursive(): boolean;
|
|
@@ -127,6 +138,7 @@ export interface IMethodResponse {
|
|
|
127
138
|
search(rx: RegExp, criteria: SearchCriteria): boolean;
|
|
128
139
|
searchString(criteria: SearchCriteria): string;
|
|
129
140
|
}
|
|
141
|
+
export declare const tagTypes: (api: ApiModel, types: TypeList) => {};
|
|
130
142
|
export interface IProperty extends ITypedSymbol {
|
|
131
143
|
required: boolean;
|
|
132
144
|
nullable: boolean;
|
|
@@ -302,6 +314,7 @@ export declare class Type implements IType {
|
|
|
302
314
|
jsonName: string;
|
|
303
315
|
refCount: number;
|
|
304
316
|
constructor(schema: OAS.SchemaObject, name: string);
|
|
317
|
+
get metaType(): MetaType;
|
|
305
318
|
get fullName(): string;
|
|
306
319
|
get owner(): string;
|
|
307
320
|
get writeable(): IProperty[];
|
|
@@ -335,7 +348,7 @@ export declare class ArrayType extends Type {
|
|
|
335
348
|
export declare class EnumType extends Type implements IEnumType {
|
|
336
349
|
elementType: IType;
|
|
337
350
|
readonly values: EnumValueType[];
|
|
338
|
-
constructor(elementType: IType, schema: OAS.SchemaObject,
|
|
351
|
+
constructor(elementType: IType, schema: OAS.SchemaObject, api: ApiModel, typeName?: string, methodName?: string);
|
|
339
352
|
private findName;
|
|
340
353
|
searchString(criteria: SearchCriteria): string;
|
|
341
354
|
get className(): string;
|
|
@@ -388,6 +401,7 @@ export declare class ApiModel implements ISymbolTable, IApiModel {
|
|
|
388
401
|
methods: MethodList;
|
|
389
402
|
types: TypeList;
|
|
390
403
|
tags: TagList;
|
|
404
|
+
typeTags: TypeTagList;
|
|
391
405
|
constructor(spec: OAS.OpenAPIObject);
|
|
392
406
|
get version(): string;
|
|
393
407
|
get description(): string;
|
|
@@ -405,6 +419,7 @@ export declare class ApiModel implements ISymbolTable, IApiModel {
|
|
|
405
419
|
registerEnum(type: IType, methodName?: string): IType;
|
|
406
420
|
private _getRequestType;
|
|
407
421
|
getRequestType(method: IMethod): IType | undefined;
|
|
422
|
+
getEnumList(): TypeList;
|
|
408
423
|
makeWriteableType(hash: string, type: IType): WriteType;
|
|
409
424
|
mayGetWriteableType(type: IType): IType | WriteType | undefined;
|
|
410
425
|
loadDynamicTypes(): void;
|