Skip to content

Correct imageSize in the image contract, which is a string - #30

Merged
MarcelloDuarte merged 1 commit into
mainfrom
fix/image-size-is-a-string
Jul 31, 2026
Merged

Correct imageSize in the image contract, which is a string#30
MarcelloDuarte merged 1 commit into
mainfrom
fix/image-size-is-a-string

Conversation

@MarcelloDuarte

Copy link
Copy Markdown
Contributor

ImageProviderInterface declared imageSize?: int on both generateImage() and editImage(). No provider has ever honoured that: every provider names its own sizes and they are all strings. Google takes "1K", "2K" and "4K"; OpenAI takes "1024x1024".

This surfaced while fixing image generation in papi-ai/google. As soon as that provider's own docblock was corrected to string, Psalm rejected the implementation for not matching the interface, which is the contract pointing at its own error.

Correcting the contract rather than bending the provider back to int closes it at the source, and stops the next provider that implements this interface from inheriting the same wrong hint.

Docblock only. No behaviour changes, no signature changes, so this is a patch.

Every provider that implements ImageProviderInterface names its own sizes, and
they are all strings: "1K", "2K" and "4K" on Google, "1024x1024" on OpenAI. The
docblock said int, which no implementation has ever honoured.

Google's provider passes "2K" today, so Psalm rejected the implementation as
soon as the provider's own docblock was made honest. Correcting the contract
rather than the provider closes it at the source.

Docblock only, so no behaviour changes.
@MarcelloDuarte
MarcelloDuarte merged commit 0f70cc7 into main Jul 31, 2026
6 checks passed
@MarcelloDuarte
MarcelloDuarte deleted the fix/image-size-is-a-string branch July 31, 2026 16:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant