@@ -44,20 +44,28 @@ function makeInitial(srcData, generator) {
4444 return template
4545}
4646
47- function genImports ( properties ) {
48- var result = new Set ( )
47+ function genImportsSet ( properties , target ) {
4948 for ( var propName in properties ) {
5049 var props = properties [ propName ]
5150 var annotate = props [ 'x-annotate' ]
52- if ( propName !== 'children' && props [ 'x-source' ] == 'inject' && annotate ) {
53- forEachSizeAnnotation ( annotate , _ => {
54- result . add ( 'com.peregrine.model.api.ImageInfo' )
55- result . add ( 'java.awt.Dimension' )
56- } )
51+ if ( propName !== 'children' ) {
52+ if ( props [ 'x-source' ] == 'inject' && annotate ) {
53+ forEachSizeAnnotation ( annotate , _ => { console . log ( `${ propName } : ${ JSON . stringify ( props ) } ` )
54+ target . add ( 'com.peregrine.model.api.ImageInfo' )
55+ target . add ( 'java.awt.Dimension' )
56+ } )
57+ } else if ( props [ 'x-form-type' ] === 'reference' ) {
58+ genImportsSet ( props . properties , target )
59+ }
5760 }
5861 }
5962
60- return Array . from ( result ) . reduce ( ( all , next ) => `${ all } import ${ next } ;\n` , '' )
63+ return target
64+ }
65+
66+ function genImports ( properties ) {
67+ return Array . from ( genImportsSet ( properties , new Set ( ) ) )
68+ . reduce ( ( all , next ) => `${ all } import ${ next } ;\n` , '' )
6169}
6270
6371function forEachSizeAnnotation ( crudeValues , callback ) {
0 commit comments