Closed michelboaventura closed 9 months ago
If my suspicious is correct I'm more than glad to create a PR fixing the types.
PR welcome for sure!
Since the files are being generated by the openapi specs, how should I address this on the code?
The issue stems in a heuristic used to resolve named parameters in inputs to spec types. When the name matches it will use that to set a reference to the related type, apparently this does not work in this particular case.
To make it work properly I think we'll need another pass to first collect all the types to check whether the references are correct.
However, it might me more feasible to simply disable the part where the references are created. There resulting types will be weaker. In the case of capabilities it will become: optional(:capabilities) => map(),
but it will be correct. Later on a better method can be found.
This should be enough to fix it.
@@ -73,7 +74,7 @@ defmodule Stripe.OpenApi.Phases.Compile do
quote do
@spec unquote(function_name)(
unquote_splicing(argument_specs),
- params :: unquote(to_inline_spec(param_specs)),
+ params :: unquote(to_inline_spec(params)),
opts :: Keyword.t()
) ::
{:ok, unquote(success_response_spec)}
This issue has been automatically marked as "stale:discard". If this issue still relevant, please leave any comment (for example, "bump"), and we'll keep it open. We are sorry that we haven't been able to prioritize it yet. If you have any new additional information, please include it with your comment.
Closing this issue after a prolonged period of inactivity. If this issue is still relevant, feel free to re-open the issue. Thank you!
Package Version
3.0.0
Are you using the latest version?
Steps to Reproduce
Stripe's created account allows us to pass
card_payments
as a capability as described here, but stripity-stripe's type on the same function doesn't include it here.So if you call:
Expected Result
Dialyzer shouldn't complain.
Actual Result
I got this dialyzer error: