openapi-generator
openapi-generator copied to clipboard
[REQ][Kotlin] Fake mock library on OpenAPI examples
Many Kotlin/mobile developers need to work with APIs without depending on a running backend. Currently, offline development or mock flavors require either:
- Maintaining large amounts of hand-written or recorded JSON mock data
- Writing custom fake clients by hand
This is time-consuming, error-prone, and difficult to maintain when the API changes.
Describe the solution you'd like
I propose adding a new Kotlin client library type:
--library=fake
This would generate:
- Standard models (unchanged)
- Standard API interfaces (unchanged)
-
Fake API implementations (
FakeApi) for each API interface
Each fake API method would return data derived from the OpenAPI specification:
- Example fields, if present
- Default values, if present
- Schema-derived fake data as fallback (strings, numbers, enums, nested objects, arrays)
This approach produces a fully on-device mock client, with no server, Docker, or Node process required.
Describe alternatives you've considered
-
WireMock / MockWebServer / Prism / Mockoon
- Requires running an embedded server or Node process
- Not practical for Android mock flavors
- Harder to keep in sync with API changes
-
Manually creating fake clients per API
- High maintenance burden
- Error-prone and repetitive
- Difficult to scale for large APIs