Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion packages/openapi-generator/src/codec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,11 @@ export function parseCodecInitializer(
// schema.location might be a package name -> need to resolve the path from the project types
const path = project.getTypes()[schema.name];
if (path === undefined)
return errorLeft(`Cannot find module '${schema.location}' in the project`);
return errorLeft(
`Cannot find external codec '${schema.name}' from module '${schema.location}'. ` +
`To fix this, add the codec definition to your codec config file. ` +
`See: https://github.com/BitGo/api-ts/tree/master/packages/openapi-generator#4-defining-custom-codecs`,
);
refSource = project.get(path);
if (refSource === undefined) {
return errorLeft(`Cannot find '${schema.name}' from '${schema.location}'`);
Expand Down
2 changes: 1 addition & 1 deletion packages/openapi-generator/test/apiSpec.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -290,5 +290,5 @@ const MISSING_REFERENCE = {
};

testCase('missing reference', MISSING_REFERENCE, '/index.ts', {}, [
"Cannot find module 'foo' in the project",
"Cannot find external codec 'Foo' from module 'foo'. To fix this, add the codec definition to your codec config file. See: https://github.com/BitGo/api-ts/tree/master/packages/openapi-generator#4-defining-custom-codecs",
]);
Loading