2017-06-11 78 views
0

我有這個YAML文件:告訴鬍子忽略特定屬性名

swagger: '2.0' 
definitions: 
    Customer: 
    type: object 
    properties: 
     toIgnore: 
     type: string 
     name: 
     type: string 

這鬍子模板,創建招搖,代碼生成的Java文件:

{{#vars}} 
    public static final {{{datatypeWithEnum}}} {{name}}="{{name}}"; 
{{/vars}}     

我想告訴招搖,代碼生成忽略爲屬性「toIgnore」創建此行並將此行創建爲其他屬性。

我該怎麼辦?

回答

0

你嘗試打印何時toIgnore空?

{{#toIgnore}} 
{{/toIgnore}} 
{{^toIgnore}} 
    public static final {{{datatypeWithEnum}}} {{name}}="{{name}}"; 
{{/toIgnore}} 
+0

是,不工作 –

+0

即使你toIgnore屬性設置值? – user7294900