plaid / plaid-openapi

API version 2020-09-14
https://plaid.com/docs
91 stars 37 forks source link

Patterns for strings where feasible #60

Open relsunkaev opened 2 years ago

relsunkaev commented 2 years ago

We use the OpenAPI schema to mock the Plaid API and generate responses for property-based testing. With some string fields (like account_id, item_id, and access_token) we had to add the patterns ourselves since any utf8 strings, including empty ones, are conformant to the definition and we didn't want to use up the testing time on unrealistic cases. Would it be possible to add patterns like [a-zA-Z0-9]{37}, access-(?:sandbox|development|production)-{insert uuid4 regex}, etc. for fields where possible? This would also help us know exactly what kind of output to expect from the API and when those outputs change format so that we can validate inputs more strictly and perform optimizations like adjusting string column lengths in our database.

phoenixy1 commented 2 years ago

I'll add this to the backlog. Note that we'd probably only want to do this for patterns that we are 100% sure will never change -- we've had issues where being overly prescriptive adds that enforcement to generated client libraries, which is not a thing we want to do because people are forced to upgrade their clibs to use the changed API