File tree Expand file tree Collapse file tree
packages/openapi-ts/src/plugins/@faker-js/faker Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ import { log } from '@hey-api/codegen-core' ;
12import { buildSymbolIn , pathToName } from '@hey-api/shared' ;
23
34import { $ } from '../../../../ts-dsl' ;
@@ -20,22 +21,28 @@ export function exportAst({
2021 isCircularSchema ?: boolean ;
2122} ) : void {
2223 const name = pathToName ( path , { anchor : namingAnchor } ) ;
24+ const symbolIn = buildSymbolIn ( {
25+ meta : {
26+ category : 'schema' ,
27+ path,
28+ tags,
29+ tool : 'faker' ,
30+ ...meta ,
31+ } ,
32+ name,
33+ naming,
34+ plugin,
35+ schema,
36+ } ) ;
2337
24- const symbol = plugin . registerSymbol (
25- buildSymbolIn ( {
26- meta : {
27- category : 'schema' ,
28- path,
29- tags,
30- tool : 'faker' ,
31- ...meta ,
32- } ,
33- name,
34- naming,
35- plugin,
36- schema,
37- } ) ,
38- ) ;
38+ if ( final . resultType === 'never' ) {
39+ log . warn (
40+ `[${ plugin . name } ] ${ symbolIn . name } not generated because we can't produce data that fits its schema.` ,
41+ ) ;
42+ return ;
43+ }
44+
45+ const symbol = plugin . registerSymbol ( symbolIn ) ;
3946
4047 // Look up the TypeScript type for this schema (e.g. Foo, Bar, or PostFooResponse)
4148 const typeSymbol = plugin . querySymbol ( {
Original file line number Diff line number Diff line change @@ -74,10 +74,6 @@ export function createProcessor(
7474 tracking . isObjectByRef . set ( ctx . meta . resourceId , ! ! final . isObjectLike ) ;
7575
7676 if ( shouldExport ) {
77- // Skip exporting impossible schemas (e.g. allOf: [number, string])
78- if ( final . resultType === 'never' ) {
79- return ;
80- }
8177 exportAst ( { ...ctx , final, isCircularSchema, plugin } ) ;
8278 return ;
8379 }
You can’t perform that action at this time.
0 commit comments