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:
Similar to https://github.com/lovasoa/marshmallow_dataclass/blob/513e8bfc0dcef02314180790486cea3c04f65178/marshmallow_dataclass/mypy.py
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 mentionTypedDict('Jsonschema')which is not userfriendly.Instead, we should use
get_dynamic_class_hookhttps://github.com/python/mypy/blob/3acbf3fe78a61c19ff96754233ada453472004c4/mypy/plugin.py#L692-L705 to provide more options while creating custom resource type definition. Possible syntax:First iteration should include these features:
CustomResourceDictdynamic hookCustomResourceDefinitionTypeDictname fromkindSimilar to https://github.com/lovasoa/marshmallow_dataclass/blob/513e8bfc0dcef02314180790486cea3c04f65178/marshmallow_dataclass/mypy.py