OpenAPITools / OpenAPITools/openapi-generator
[Swift5] Generate non-static API classes
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by inspecting the Swift5 generator and the generated ClientAPI class to understand how static methods and configuration are produced. Define the flag's expected behavior for generated, instantiable API classes with per-instance configuration, and verify that existing static generation remains supported.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- swift
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100