File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed
packages/openapi-generator/src Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -179,6 +179,33 @@ const app = command({
179179 }
180180 const [ newSourceFile , init , comment ] = initE . right ;
181181
182+ if ( init === null ) {
183+ console . log ( { ref } ) ;
184+ let errorMessage = `Could not determine encode/decode types for codec '${ ref . name } ' in '${ ref . location } '` ;
185+ if ( ref . location . includes ( '/node_modules/io-ts-types/' ) ) {
186+ errorMessage += `
187+ It looks like this codec comes from io-ts-types. Try importing directly from io-ts-types instead:
188+
189+ \`\`\`
190+ import { ${ ref . name } } from 'io-ts-types';
191+ \`\`\`
192+ ` ;
193+ } else {
194+ errorMessage += `
195+ Consider defining a custom codec for this type.
196+
197+ https://github.com/BitGo/api-ts/tree/master/packages/openapi-generator#4-defining-custom-codecs
198+ ` ;
199+ }
200+ logError (
201+ errorMessage
202+ . split ( '\n' )
203+ . map ( ( line ) => line . trimStart ( ) )
204+ . join ( '\n' ) ,
205+ ) ;
206+ process . exit ( 1 ) ;
207+ }
208+
182209 const codecE = parseCodecInitializer ( project , newSourceFile , init ) ;
183210 if ( E . isLeft ( codecE ) ) {
184211 logError (
You can’t perform that action at this time.
0 commit comments