Merge pull request #3654 from github/koesie10/python-type-models

Enable type models for Python in the model editor
This commit is contained in:
Koen Vlaswinkel
2024-07-04 09:35:21 +02:00
committed by GitHub

View File

@@ -173,6 +173,31 @@ export const python: ModelsAsDataLanguage = {
}; };
}, },
}, },
type: {
extensiblePredicate: "typeModel",
// extensible predicate typeModel(string type1, string type2, string path);
generateMethodDefinition: (method) => [
method.relatedTypeName,
pythonType(method.packageName, method.typeName, method.endpointType),
pythonPath(method.methodName, method.path),
],
readModeledMethod: (row) => {
const { packageName, typeName, methodName, endpointType, path } =
parsePythonTypeAndPath(row[1] as string, row[2] as string);
return {
type: "type",
relatedTypeName: row[0] as string,
path,
signature: pythonMethodSignature(typeName, methodName),
endpointType,
packageName,
typeName,
methodName,
methodParameters: "",
};
},
},
}, },
getArgumentOptions: (method) => { getArgumentOptions: (method) => {
// Argument and Parameter are equivalent in Python, but we'll use Argument in the model editor // Argument and Parameter are equivalent in Python, but we'll use Argument in the model editor