【问题标题】:Tell mustache to ignore specific property name告诉 mustache 忽略特定的属性名称
【发布时间】:2017-11-12 23:09:06
【问题描述】:

我有这个 yaml 文件:

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

还有这个用 swagger-codegen 创建 java 文件的小胡子模板:

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

我想告诉 swagger-codegen 忽略为属性“toIgnore”创建此行并为其他属性创建此行。

我该怎么做?

【问题讨论】:

    标签: java swagger mustache swagger-codegen


    【解决方案1】:

    您是否尝试过在 toIgnore 为空时打印?

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

    【讨论】:

    • 即使你在 toIgnore 属性中设置了值?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2013-06-28
    • 2022-11-20
    • 1970-01-01
    • 2019-02-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多