我正在尝试做类似以下的事情:
在我的架构 JSON 模型部分:
"MyObject": {
"type": "object",
"description": "my description",
"properties": {
"type": "string",
"description": "my property description",
"customAnnotation": "true"
}
}
Run Code Online (Sandbox Code Playgroud)
因此,我一开始就尝试扩展 JSON Schema - 可能是我的第一个问题。但是,我不知道如何合法地做到这一点(如果可能的话)。
“customAnnotation”胡子模板的用例片段(-l spring):
{{#vars}}
{{^customAnnotation}}@CustomAnnotation {{/customAnnotation}}public {{{datatypeWithEnum}}} {{getter}}() {
return {{name}};
}
{{/vars}}
Run Code Online (Sandbox Code Playgroud)
我真的可以做这样的事情吗?线索很有帮助(是的,我是这个领域的新手)!
注意:我还想使用找到的“customAnnotation”> 0 的计数来注释类。就像是:
{{^containsCustomAnnotations}}@ContainsCustomAnnotations {{/hasCustomAnnotation}}public void MyClass {
}
Run Code Online (Sandbox Code Playgroud)
谢谢!