Open
Description
Current approach with CustomResource["relative/path/to/crd.yaml", "spec", "some_property"]
is limited to having only one definition/version in crd file and its impossible to extend with new options. Returned errors always mention TypedDict('Jsonschema')
which is not userfriendly.
Instead, we should use get_dynamic_class_hook
https://github.com/python/mypy/blob/3acbf3fe78a61c19ff96754233ada453472004c4/mypy/plugin.py#L692-L705 to provide more options while creating custom resource type definition. Possible syntax:
MyResource = CustomResourceDict(
definition_path="/path/to/crd.yaml",
property_path: ["spec", "some_property"]
group: "myapi.io",
version: "v1",
kind: "MyResource"
)
First iteration should include these features:
-
CustomResourceDict
dynamic hook - Handle multiple versions per
CustomResourceDefinition
- Handle multiple definitions per file
- Set
TypeDict
name fromkind