Skip to content

Commit f131995

Browse files
committed
refactor: improve the error message for missing external codecs in openapi-generator
following principles of 1. What went wrong and 2. how to solve it
1 parent cec1e8b commit f131995

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

packages/openapi-generator/src/codec.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -528,7 +528,11 @@ export function parseCodecInitializer(
528528
// schema.location might be a package name -> need to resolve the path from the project types
529529
const path = project.getTypes()[schema.name];
530530
if (path === undefined)
531-
return errorLeft(`Cannot find module '${schema.location}' in the project`);
531+
return errorLeft(
532+
`Cannot find external codec '${schema.name}' from module '${schema.location}'. ` +
533+
`To fix this, add the codec definition to your codec config file. ` +
534+
`See: https://github.com/BitGo/api-ts/tree/master/packages/openapi-generator#4-defining-custom-codecs`,
535+
);
532536
refSource = project.get(path);
533537
if (refSource === undefined) {
534538
return errorLeft(`Cannot find '${schema.name}' from '${schema.location}'`);

0 commit comments

Comments
 (0)