stripe / openapi

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

Get Subset of spec2.json #46

Closed kamipatel closed 5 years ago

kamipatel commented 5 years ago

The tool I am using fails because spec2.json swagger file is too big. I just need APIs to charge customer credit card and retrieve the past payments. How can I do that? Thanks!

brandur-stripe commented 5 years ago

@kamipatel I'd suggest using a JSON-processing tool like jq to filter the spec down to just the parts you care about. Take some heed though that this is going to be trickier than it initially sounds — although filtering down to just customer-related API endpoints will be relatively simple, it may be a bit harder to make sure that just the customer resources and subresources that those endpoints reference end up in the final product.

What you might need by the end of it is a script that tries to do the filtering intelligently and does same basic reference following to end up with the write answer.

That said, the time to write it might be more productively spent seeing if you can fix your target tool to be able to ingest larger files. I'll also quickly mention that you should consider the OpenAPI 2 spec to be deprecated — we generate it, but only because it's not too much trouble, and we know that it doesn't accurately describe the API because OpenAPI 2 lacks the expressiveness to do properly do so. It'd be a good idea to be investing in the direction of OpenAPI 3 (spec3.*) instead.