openapi-codegen icon indicating copy to clipboard operation
openapi-codegen copied to clipboard

Error in getReferenceSchema when namespace contains a dot character

Open CristiV opened this issue 2 years ago • 0 comments

When the namespace contains dots, there is the following error: Internal Error: #/components/schemas/Api.v1.ClassName not found! at getReferenceSchema (D:\Projects\JVM.BackOffice\node_modules@openapi-codegen\typescript\lib\core\getReferenceSchema.js:20:15)

This happens because of line 18 in getReferenceSchema, which uses dot as a special separator character: const referenceSchema = (0, lodash_1.get)(openAPIDocument, refPath.join("."));

The fix is to use the other overload of get which can accept an array directly, like the following: const referenceSchema = (0, lodash_1.get)(openAPIDocument, refPath);

CristiV avatar Mar 14 '23 14:03 CristiV