@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 +62 -1
- package/README.md +1 -0
- package/lib/esm/go.gen.js +5 -6
- package/lib/esm/go.gen.js.map +1 -1
- package/lib/esm/python.gen.js +5 -0
- package/lib/esm/python.gen.js.map +1 -1
- package/lib/esm/sdkModels.js +31 -13
- package/lib/esm/sdkModels.js.map +1 -1
- package/lib/esm/specConverter.js +5 -1
- package/lib/esm/specConverter.js.map +1 -1
- package/lib/esm/swift.gen.js +59 -22
- package/lib/esm/swift.gen.js.map +1 -1
- package/lib/esm/typescript.gen.js +3 -2
- package/lib/esm/typescript.gen.js.map +1 -1
- package/lib/go.gen.d.ts +1 -0
- package/lib/go.gen.js +5 -6
- package/lib/go.gen.js.map +1 -1
- package/lib/python.gen.js +5 -0
- package/lib/python.gen.js.map +1 -1
- package/lib/sdkModels.d.ts +2 -1
- package/lib/sdkModels.js +31 -13
- package/lib/sdkModels.js.map +1 -1
- package/lib/specConverter.d.ts +8 -6
- package/lib/specConverter.js +9 -2
- package/lib/specConverter.js.map +1 -1
- package/lib/swift.gen.d.ts +5 -0
- package/lib/swift.gen.js +60 -21
- package/lib/swift.gen.js.map +1 -1
- package/lib/typescript.gen.js +3 -2
- package/lib/typescript.gen.js.map +1 -1
- package/package.json +3 -3
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":";;;;;;;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,MA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,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 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":["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","object","uri","void","el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Q,GAAG,KAAKzB,qBAAL,CAA2BtH,IAAI,CAAC2B,IAAhC,EAAsC4F,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,CAAenJ,IAAf,CAAvC,EAAN;AAxBJ;;AA0BA,UAAMoJ,EAAe,GAAG;AAAExF,QAAAA,OAAO,EAAEoF,YAAX;AAAyBrH,QAAAA,IAAI,EAAEA;AAA/B,OAAxB;;AACA,UAAI6G,KAAJ,EAAW;AACTY,QAAAA,EAAE,CAACZ,KAAH,GAAWA,KAAX;AACD;;AACD,aAAOY,EAAP;AACD;;AACD,QAAI,CAACpJ,IAAI,CAAC2B,IAAV,EAAgB;AACd,YAAM,IAAIsH,KAAJ,CAAU,gCAAV,CAAN;AACD;;AACD,QAAMtH,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;;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"}
|
package/lib/sdkModels.d.ts
CHANGED
|
@@ -348,7 +348,7 @@ export declare class ArrayType extends Type {
|
|
|
348
348
|
export declare class EnumType extends Type implements IEnumType {
|
|
349
349
|
elementType: IType;
|
|
350
350
|
readonly values: EnumValueType[];
|
|
351
|
-
constructor(elementType: IType, schema: OAS.SchemaObject,
|
|
351
|
+
constructor(elementType: IType, schema: OAS.SchemaObject, api: ApiModel, typeName?: string, methodName?: string);
|
|
352
352
|
private findName;
|
|
353
353
|
searchString(criteria: SearchCriteria): string;
|
|
354
354
|
get className(): string;
|
|
@@ -419,6 +419,7 @@ export declare class ApiModel implements ISymbolTable, IApiModel {
|
|
|
419
419
|
registerEnum(type: IType, methodName?: string): IType;
|
|
420
420
|
private _getRequestType;
|
|
421
421
|
getRequestType(method: IMethod): IType | undefined;
|
|
422
|
+
getEnumList(): TypeList;
|
|
422
423
|
makeWriteableType(hash: string, type: IType): WriteType;
|
|
423
424
|
mayGetWriteableType(type: IType): IType | WriteType | undefined;
|
|
424
425
|
loadDynamicTypes(): void;
|
package/lib/sdkModels.js
CHANGED
|
@@ -1028,7 +1028,7 @@ class Type {
|
|
|
1028
1028
|
load(api) {
|
|
1029
1029
|
Object.entries(this.schema.properties || {}).forEach(_ref7 => {
|
|
1030
1030
|
var [propName, propSchema] = _ref7;
|
|
1031
|
-
var propType = api.resolveType(propSchema, undefined, propName);
|
|
1031
|
+
var propType = api.resolveType(propSchema, undefined, propName, this.name);
|
|
1032
1032
|
|
|
1033
1033
|
if (propType.instanceOf('EnumType')) {
|
|
1034
1034
|
api.registerEnum(propType, propName);
|
|
@@ -1146,7 +1146,7 @@ class ArrayType extends Type {
|
|
|
1146
1146
|
exports.ArrayType = ArrayType;
|
|
1147
1147
|
|
|
1148
1148
|
class EnumType extends Type {
|
|
1149
|
-
constructor(elementType, schema,
|
|
1149
|
+
constructor(elementType, schema, api, typeName, methodName) {
|
|
1150
1150
|
super(schema, schema.name);
|
|
1151
1151
|
this.elementType = elementType;
|
|
1152
1152
|
|
|
@@ -1163,27 +1163,36 @@ class EnumType extends Type {
|
|
|
1163
1163
|
}
|
|
1164
1164
|
|
|
1165
1165
|
if (methodName) {
|
|
1166
|
-
this.description = "
|
|
1166
|
+
this.description = "".concat(this.description).concat(this.description ? ' ' : '', "(Enum defined in ").concat(methodName, ")");
|
|
1167
1167
|
}
|
|
1168
1168
|
|
|
1169
|
-
this.name = this.findName(
|
|
1169
|
+
this.name = this.findName(api, typeName, methodName);
|
|
1170
1170
|
}
|
|
1171
1171
|
|
|
1172
|
-
findName(
|
|
1172
|
+
findName(api, typeName, methodName) {
|
|
1173
|
+
var hash = (0, _blueimpMd.default)(this.asHashString());
|
|
1174
|
+
var enums = api.getEnumList();
|
|
1173
1175
|
var name = titleCase(this.name || typeName || 'Enum');
|
|
1174
1176
|
|
|
1175
|
-
if (name in types) {
|
|
1177
|
+
if (name in api.types) {
|
|
1178
|
+
var matched = enums[hash];
|
|
1179
|
+
|
|
1180
|
+
if ((matched === null || matched === void 0 ? void 0 : matched.name) === name) {
|
|
1181
|
+
return name;
|
|
1182
|
+
}
|
|
1183
|
+
|
|
1176
1184
|
var baseName = methodName ? titleCase("".concat(methodName, "_").concat(name)) : name;
|
|
1177
1185
|
var newName = baseName;
|
|
1178
1186
|
var i = 0;
|
|
1179
1187
|
|
|
1180
|
-
while (newName in types) {
|
|
1188
|
+
while (newName in api.types) {
|
|
1181
1189
|
newName = "".concat(baseName).concat(++i);
|
|
1182
1190
|
}
|
|
1183
1191
|
|
|
1184
1192
|
name = newName;
|
|
1185
1193
|
}
|
|
1186
1194
|
|
|
1195
|
+
enums[hash] = this;
|
|
1187
1196
|
return name;
|
|
1188
1197
|
}
|
|
1189
1198
|
|
|
@@ -1535,7 +1544,7 @@ class ApiModel {
|
|
|
1535
1544
|
}
|
|
1536
1545
|
|
|
1537
1546
|
if (this.schemaHasEnums(schema)) {
|
|
1538
|
-
var num = new EnumType(resolved, schema, this
|
|
1547
|
+
var num = new EnumType(resolved, schema, this, typeName, methodName);
|
|
1539
1548
|
this.registerEnum(num, methodName);
|
|
1540
1549
|
var result = new ArrayType(num, schema);
|
|
1541
1550
|
return result;
|
|
@@ -1545,7 +1554,9 @@ class ApiModel {
|
|
|
1545
1554
|
}
|
|
1546
1555
|
|
|
1547
1556
|
if (this.schemaHasEnums(schema)) {
|
|
1548
|
-
var
|
|
1557
|
+
var _resolved = this.resolveType(schema.type, style, typeName, methodName);
|
|
1558
|
+
|
|
1559
|
+
var _result = new EnumType(_resolved, schema, this, typeName, methodName);
|
|
1549
1560
|
|
|
1550
1561
|
if (_result) {
|
|
1551
1562
|
return this.registerEnum(_result, methodName);
|
|
@@ -1587,10 +1598,14 @@ class ApiModel {
|
|
|
1587
1598
|
|
|
1588
1599
|
registerEnum(type, methodName) {
|
|
1589
1600
|
if (!(type instanceof EnumType)) return type;
|
|
1590
|
-
var hash = (0, _blueimpMd.default)(type.asHashString());
|
|
1591
1601
|
|
|
1592
|
-
if (
|
|
1593
|
-
|
|
1602
|
+
if (type.name in this.types) {
|
|
1603
|
+
var hash = (0, _blueimpMd.default)(type.asHashString());
|
|
1604
|
+
var matched = this.enumTypes[hash];
|
|
1605
|
+
|
|
1606
|
+
if ((matched === null || matched === void 0 ? void 0 : matched.name) === type.name) {
|
|
1607
|
+
return this.enumTypes[hash];
|
|
1608
|
+
}
|
|
1594
1609
|
}
|
|
1595
1610
|
|
|
1596
1611
|
if (methodName) {
|
|
@@ -1603,7 +1618,6 @@ class ApiModel {
|
|
|
1603
1618
|
}
|
|
1604
1619
|
}
|
|
1605
1620
|
|
|
1606
|
-
this.enumTypes[hash] = type;
|
|
1607
1621
|
this.types[type.name] = type;
|
|
1608
1622
|
return type;
|
|
1609
1623
|
}
|
|
@@ -1625,6 +1639,10 @@ class ApiModel {
|
|
|
1625
1639
|
return result;
|
|
1626
1640
|
}
|
|
1627
1641
|
|
|
1642
|
+
getEnumList() {
|
|
1643
|
+
return this.enumTypes;
|
|
1644
|
+
}
|
|
1645
|
+
|
|
1628
1646
|
makeWriteableType(hash, type) {
|
|
1629
1647
|
var writer = new WriteType(this, type);
|
|
1630
1648
|
this.types[writer.name] = writer;
|