Adopting the OpenAPI schema to generate Plaid’s SDKs
plaid.com
plaid.com
For example, they want all arguments to be typed. So instead of using DoSomething("US"), they want DoSomething(SomePlaidCountry("US")). It gets extremely verbose -- for no good reason either as it just moves the runtime check in another method, it doesn't remove it. What's more, it doesn't even actually use python typings. In fact it's super incompatible with them because a bunch of their types are generated at runtime, lazily imported, using magic etc which confuses typing engines.
What would this look like it it were any good? Native python types and native enums. But i doubt anyone on their python team has worked with either, as they just reinvented the wheel.
Example issue: https://github.com/plaid/plaid-python/issues/340
Hello! I'm assuming you're talking about Python type hints: https://docs.python.org/3/library/typing.html.
I love these :). I remember back in uni I would fill my program with them, but then fail the autograder because they were using an older version of Python 3 (support was only added in 3.5). I also remember back when the system didn't even have support for self-hoisting, so you couldn't make recursive type definitions and would have to do string annotations like `(x: 'LinkedListNode')`. Fun times.
Assuming that strongly typing the library in some way is beneficial (which we believed), let's look into the options we're provided here. Python's current type hint system requires external tools to enforce it and isn't enforced at runtime or "compilation." The system we have in our library creates a ton of objects that end up enforcing runtime constraints on input values. Failing at runtime because of invalid input is good. I've worked on Python stacks that totally do not use type hints (and my Emacs setup probably didn't back then either), and would have been saved tons of time debugging if the library just told me I was doing things wrong. This is at a definite cost of verbosity. There are definitely ways we can cut verbosity in this model (enums was actually a great example). Considering we were working on 5 languages at the same time though, it was difficult to do everything we wanted before shipping.
There's also the final reality that the generator we chose to use defaults to this behavior. We didn't find a better OpenAPI generator out there, and we weren't opposed to this generated output. There wasn't much wheel invention here, but we did attempt to make it spin smoother at times :D.
There are strong advantages for maintainers to generate from an OpenAPI spec, but I get the feeling consumers (devs, implementers) don’t like them as much. But that may be dependent on the language, or entirely false. Mostly based on anecdotal feedback, and primarily from those who were happy with an existing SDK and, understandably, didn’t want to change.
I’d be keen to hear what HN users think.
AWS SDKs must be generated and they are mostly good but some of them like S3 are so heavily used they could have teams writing them no probs. GCPs are (or were?) super verbose which is a GRPC generation artifact, same as openapi.
Keen to know some thoughts on the code quality.
https://plaid.com/use-cases/consumer-payments/ https://plaid.com/docs/quickstart/#setting-up-for-payment-in...
Plaid's true value add is normalized access to transactions and other banking metadata. Using it only for payments is not a good UX.
Plaid is mostly a screen-scraper of banking data. Users give you their banking credentials and plaid gives you scraped transaction history.
https://plaid.com/use-cases/consumer-payments/ https://plaid.com/docs/quickstart/#setting-up-for-payment-in...
Actually creating a startup around this: https://sdkeasy.com
TLDR: There are a good many technical challenges to creating high-quality SDKs in multiple languages for a medium to large-sized REST API and most teams seem to underestimate the amount of effort required to build and maintain SDKs. The speed and savings from code generation is quite compelling and a modern commercial code generator like APIMatic has a wide-enough feature-set that most REST APIs don't require writing SDKs by hand anymore.
Disclaimer: I am a contributor to APIMatic Code Generator.
Swagger Codegen: https://github.com/swagger-api/swagger-codegen
OpenAPI Generator: https://github.com/OpenAPITools/openapi-generator
AutoRest: https://github.com/Azure/AutoRest
NSwag: https://github.com/RicoSuter/NSwag
oapi-codegen: https://github.com/deepmap/oapi-codegen
go-swagger: https://github.com/go-swagger/go-swagger
Back in 2014, OpenAPI didn't even exist. The latest API specification format was Swagger 1.2 and it was not very mature at that point. We had to build a lot of vendor extensions to cover the various REST API use-cases that API folks take for granted today.
Today, we also run the most-used API Spec format convertor tool in the world by the name of API Transformer [2]; this tool has helped a lot of companies migrate from an older spec formats like OpenAPI 2 and RAML to OpenAPI 3. We support nearly all API specification formats including RAML, OpenAPI (2., 3.), Blueprint, Postman, WADL and more.[3]
[1] https://www.apimatic.io/about/ [2] https://www.apimatic.io/transformer/ [3] https://docs.apimatic.io/api-transformer/overview-transforme... [4] https://www.apimatic.io/developer-experience-portal