stripe / openapi

An OpenAPI specification for the Stripe API.
MIT License
394 stars 123 forks source link

Application is missing an x-resourceId #83

Closed arlyon closed 2 years ago

arlyon commented 2 years ago

Hi!

I am the maintainer of arlyon/async-stripe, and we've run into an issue with setup intents and applications: https://github.com/arlyon/async-stripe/issues/183

The heuristic we use (for better or worse) for determining if the resource can be expanded (ie represented by an id and an object) is

This works in most cases however we discovered that in some cases there aren't x-resourceId's; application is one of these cases.

So my request is this: would you be open to be adding a sample application to the fixtures and additionally adding the x-resourceId field? I would submit a PR however I understand that these definitions are autogenerated.

Many thanks

Alex

richardm-stripe commented 2 years ago

Hi @arlyon. The presence of x-resourceId isn't really a reliable indicator of expandability - it means that the object is used directly as part of the response to any API method (which application is not, there is no /v1/applications API).

The way we detect expandability in our own codegen tooling is by traversing the spec looking for all the expansion sites (an anyOf with a string and something else, with x-expansionResources set), and recording what is being referenced (['x-stripeExpansionResources'][0].oneOf[0]['x-stripeResource'].class_name

arlyon commented 2 years ago

Amazing, thank you for the quick response. I will update our codegen to match that, and consider this issue resolved :tada: