I've recently started playing around with OpenAPI's (fka Swagger) client generation tools but found myself perplexed by the patterns required to use the generated client.
Using their petstore client as an example, to actually use the generated client, you need to:
- Create a configuration.
- Create a client instance using the configuration.
- Create an API instance using the client.
- Call the API using the API instance.
My question is about why the "API instance" layer even exists.
Is this some sort of design pattern that I'm not familiar with?
What's the intended benefit of adding an API instance layer between creating a client and making API calls?
It should be noted that this pattern doesn't only apply to generated Python clients. It appears that many of the other client generation languages like Java, PHP, and C# as well.
Aucun commentaire:
Enregistrer un commentaire