-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Description
If I extract a swagger.json from my cluster, slice out my custom resources, and feed it to lightkube-generate, it fails because of assertions about schema naming:
python -m lightkube-generate resources models ./swagger.json
Traceback (most recent call last):
File "/usr/local/opt/python@3.7/Frameworks/Python.framework/Versions/3.7/lib/python3.7/runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "/usr/local/opt/python@3.7/Frameworks/Python.framework/Versions/3.7/lib/python3.7/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/Users/tmiller/Documents/projects/lightkube-models/lightkube-generate/__main__.py", line 19, in <module>
compile_resources.execute(Path(args.specs), Path(args.dest), Path(args.testdir), Path(args.docs), compiler_major)
File "/Users/tmiller/Documents/projects/lightkube-models/lightkube-generate/compile_resources.py", line 321, in execute
modules = compile_resources(aggregate(extract(specs)), dest, testdir.joinpath("test_resources.py"))
File "/Users/tmiller/Documents/projects/lightkube-models/lightkube-generate/compile_resources.py", line 145, in aggregate
for ele in it:
File "/Users/tmiller/Documents/projects/lightkube-models/lightkube-generate/compile_resources.py", line 107, in extract
model_schema = schema_name(schema['$ref'])
File "/Users/tmiller/Documents/projects/lightkube-models/lightkube-generate/model.py", line 24, in schema_name
assert len(parts) <= 3
AssertionError
The definition in question in this case is (orig_name fed to schema_name()):
#/definitions/uk.co.networkop.v1beta1.TopologyList
The parts length assertion may be only one issue; there could be more buried in deeper.
However, it would be /really convenient/ to be able to generate my own resources and models from swagger. While this clearly what's intended (i.e., lightkube generic models), the ability to turn CRs into first-class lightkube objects would be nice, as it would simplify handling and introspection of K8s objects regardless of source.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels