File tree Expand file tree Collapse file tree 2 files changed +6
-2
lines changed Expand file tree Collapse file tree 2 files changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -178,7 +178,6 @@ Object {
178178
179179exports [` type类型_10 1` ] = `
180180Object {
181- " definitions" : Object {},
182181 " enum" : Array [
183182 1 ,
184183 2 ,
Original file line number Diff line number Diff line change @@ -326,7 +326,8 @@ export default class genTypeSchema extends typescriptToFileDatas {
326326
327327 item . $ref = `#/definitions/${ $refKey } ` ;
328328
329- if ( ! $refJson . $ref ) {
329+ // fileJson[$refJson.$ref.replace(/#(\/definitions\/)?/, '')] 表示在本文件就能找到
330+ if ( ! $refJson . $ref || fileJson [ $refJson . $ref . replace ( / # ( \/ d e f i n i t i o n s \/ ) ? / , '' ) ] ) {
330331 // 有继承
331332 if ( $refJson . extends ) {
332333 $refJson = handleExtends ( $refJson ) ;
@@ -625,6 +626,10 @@ export default class genTypeSchema extends typescriptToFileDatas {
625626 const res = definitions [ key ] || { definitions : { } } ;
626627 delete typeJson_ . definitions [ key ] ;
627628 res . definitions = { ...res . definitions , ...typeJson_ . definitions } ;
629+ // 枚举类型且 definitions 为空,需删掉 definitions
630+ if ( res . enum && ! Object . keys ( res . definitions ) . length ) {
631+ delete res . definitions ;
632+ }
628633 typeJson = res ;
629634 }
630635 } ;
You can’t perform that action at this time.
0 commit comments