I wrote an openapi specification and now I want to generate a client for it.
So I went with openapi generator and generated a typescript-axios client using this command:
openapi-generator-cli generate -g typescript-axios -i openapi.yaml -o src/client
However while generating I got a lot of errors, most of them being related to self reference check
[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
Then I checked the generated src/client, and it was full of type errors and import errors. e.g.
import { Id } from './Id';
while there's no Id.ts
I understand it is because of the use of many self-referencing in my spec, but I need them. It is almost possible to have no self-references.
I searched for help but did not find much useful information.
So is it possible that I can somehow fix it or use another tool? Thanks a lot.