I created an openapi specification and now I am looking to generate a client for it.
openapi.yaml
After some research, I decided to use the openapi generator to create a typescript-axios client. This is the command I used:
openapi-generator-cli generate -g typescript-axios -i openapi.yaml -o src/client
Unfortunately, the generation process resulted in multiple errors, mostly related to self-referencing checks:
[main] ERROR o.o.codegen.utils.ModelUtils - Failed to obtain schema from `createdAt` in self reference check
[main] ERROR o.o.codegen.utils.ModelUtils - Failed to obtain schema from `lastModified` in self reference check
[main] ERROR o.o.codegen.utils.ModelUtils - Failed to obtain schema from `lastModified` in self reference check
[main] ERROR o.o.codegen.utils.ModelUtils - Failed to obtain schema from `slink` in self reference check
[main] ERROR o.o.codegen.utils.ModelUtils - Failed to obtain schema from `slink` in self reference check
[main] ERROR o.o.codegen.utils.ModelUtils - Failed to obtain schema from `id` in self reference check
Upon inspecting the generated src/client
directory, I encountered numerous type errors and import errors, such as:
import { Id } from './Id';
despite the absence of Id.ts file.
I acknowledge that these issues stem from my specification's extensive self-referencing, but eliminating them completely is not feasible.
Despite searching for solutions, I was unable to find much helpful guidance.
Is there a way to resolve these errors or should I consider using a different tool? Your assistance is greatly appreciated.