Model IDs with dots in them cause Python generated code to fail
The class name in python can't contain dots "." which make the generated code to fail.
I think this error is due to the swagger-spec used to generate code but not swagger-codegen issue.
Technically, it's legal to have dots in model names in the spec, and those need to be escaped (or handled differently) by the generator.
@wing328, @fehguy, For python dots in file name should be replaced by underscore. But now they are replaced by / (https://github.com/swagger-api/swagger-codegen/blob/develop_2.0/modules/swagger-codegen/src/main/java/com/wordnik/swagger/codegen/DefaultCodegen.java#L1100) This method is static and it's impossible to override it. I'm thinking to remove static and override the method. What do you think?
@lugaru1234 As an example, do you mind showing me what the file name (full path) looks like and what's the class name for the model with dot ?
@wing328, I took this file for the testing https://github.com/GoogleCloudPlatform/kubernetes/blob/master/api/swagger-spec/v1beta3.json#L6361. Will take v1beta3.ResourceQuota as example. In the current state classname=V1beta3ResourceQuota and classVarName=v1beta3/resource_quota. classVarName then is used in __init__package.mustache template and generated code looks like "from .models.v1beta3/resource_quota import V1beta3ResourceQuota". Full path for that file is client/models/v1beta3/resource_quota.py
@lugaru1234 thanks for the information. I'll see what I can do.
@wing328 - @lugaru1234 is working on the issue, just need some pointers regarding the comment made above. Would be great if you can voice your opinion with the knowledge you have of the code.
@lugaru1234 A good starting point is the toModelFileName function in Python client codegen
Adding a line to replace . with _ before calling underscore should be able to resolve the issue.
If testing confirms the fix works, please update toModelName as well with the same fix.