You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently OpenAPI generator codegen is simple bad also bad, there is no straightforward to actually mock the API calls, because those functions are not generic and they only getting the configuration injected. So the only thing you can actually mock is probably the API endpoint but the network call will still occur.
Ideally there should be some kind of a trait that you can mock the implementation with automock library.
This is more of an investigation if there is a way to make this code more testable with mocks. I probably need to create additional generic layer between the client-sdk and the actual function calls.
AC's
After exploration further actions / tasks were created.
The tasks are prioritised
The text was updated successfully, but these errors were encountered:
The gained benefits here is less code to generate, excluding explicit functions import will drastically reduce the amount of code generated. Plus it would make the code more testable because the client is being injected into the controller.
Unfortunately it's not as straightforward for using with mockall and automock for testing, but it at least encapsulate everything under a client struct so it would be easy to just inject the client into the controllers.
Perhaps further work would be needed - like writing the mocks, but still it's an improvements than using the regular openapi generator.
Summary
Currently OpenAPI generator codegen is simple bad also bad, there is no straightforward to actually mock the API calls, because those functions are not generic and they only getting the configuration injected. So the only thing you can actually mock is probably the API endpoint but the network call will still occur.
Ideally there should be some kind of a trait that you can mock the implementation with automock library.
This is more of an investigation if there is a way to make this code more testable with mocks. I probably need to create additional generic layer between the client-sdk and the actual function calls.
AC's
The text was updated successfully, but these errors were encountered: