Skip to content

Commit 6469d88

Browse files
johanzanderclaude
andauthored
Fix incorrect type annotations in OpenApiV1 plant_id and plant_list (#159)
* Align V1 plant_id annotations with the base class GrowattApi annotates plant_id as str on every method that takes one, but OpenApiV1 annotates it as int on plant_details, plant_energy_overview, plant_power_overview, plant_energy_history and device_list. All five only pass the value through to params={"plant_id": plant_id}, so str has always worked at runtime; only the annotation disagreed. The mismatch forces callers that hold a plant id as a str to either suppress arg-type errors or coerce with int(), which breaks on non-numeric ids. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> * Return an empty dict from plant_list when "back" is absent plant_list is annotated as returning dict[str, Any], but the fallback when the response has no "back" key is [], so the empty case returns a list and contradicts the annotation. Callers that follow the annotation and do plant_info.get("data") hit an AttributeError on that path, forcing an isinstance() guard purely to defend against the default. plant_detail on the same endpoint family already defaults to {}. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
1 parent 9672b48 commit 6469d88

0 file changed

File tree

    0 commit comments

    Comments
     (0)