openapi-generator icon indicating copy to clipboard operation
openapi-generator copied to clipboard

[Swift5] Generate non-static API classes

Open vertz-island opened this issue 3 years ago • 1 comments

Is your feature request related to a problem? Please describe.

The swift5 generator generates API classes with class method, which are static, and use static configuration (the generated ClientAPI class). This makes testing, mocking and using several configurations very hard and cumbersome. This behavior does not match other generators (such as C# and typescript) that generate classes that can be instantiated and receive a configuration upon instantiation

Describe the solution you'd like

Given this is already the default behavior, i think that adding a flag that allows to generate non-static APIs will be extremely helpful

Describe alternatives you've considered

I've looked for a flag that will allow this and didn't find any (i apologize if i missed it). ATM, i'm wrapping the generated api class with a class of my own, but like i wrote above, this makes the code prone to errors, leaks and makes it cumbersome and harder to test

Additional context

vertz-island avatar Sep 18 '22 15:09 vertz-island

Bumping up, looking to build integration tests and hard to make them robust enough if testing against multiple environments

joseprl89 avatar Apr 23 '24 12:04 joseprl89