opensearch-project / opensearch-php

Official PHP Client for OpenSearch
Other
96 stars 55 forks source link

[FEATURE] Generate precise types for endpoints to allow static analysis tools to understand the signatures #217

Open stof opened 1 month ago

stof commented 1 month ago

Is your feature request related to a problem?

Currently, the generated code for endpoints uses @param array $params, which does not provide any information to static analysis tools about the supported parameters.

What solution would you like?

The generated code has some documentation for parameters, so more precise information is already available in the generator. It would be great to use it to describe the proper array shape. This would allow phpstan and psalm to detect invalid usages of the client.

Compared to the existing human-readable documentation, a few changes are needed though:

What alternatives have you considered?

Writing a phpstan plugin providing stubs maintained manually for all methods would be totally unmaintainable. It is a lot easier to make the code generator include the info directly.

Do you have any additional context?

saimedhi commented 1 month ago

Hi @stof , please feel free to contribute. Thank you.

dblock commented 2 weeks ago

Catch All Triage - 1, 2, 3