OpenAPI中地图的建模列表
我需要从 *.YAML定义文件中生成对象。我的最终目标是生成POJO,如下所示:
public class MyGeneratedPojo {
private List<Map<String, MyInternalObject>> internalProperties;
}
我知道我可以使用其他杂货来对地图进行建模。或者我可以做这样的事情:
MyGeneratedPojo:
properties:
type: array
items:
$ref: '#/.../MyInternalMapDefinition'
MyInternalMapDefinition:
type: object
additionalProperties:
type: array
items:
$ref: '#/.../MyInternalMapDefinition'
我不喜欢的是“ MyInternalMapDefinition”定义。无论如何,是否可以将其定义/模型为“ MyGeneratedPojo”的一部分
I need to generate object from *.yaml definitions file. My end goal is generated POJO like in example below:
public class MyGeneratedPojo {
private List<Map<String, MyInternalObject>> internalProperties;
}
I know that I could use additionalProperties in order to model the map. Or I could do something like this:
MyGeneratedPojo:
properties:
type: array
items:
$ref: '#/.../MyInternalMapDefinition'
MyInternalMapDefinition:
type: object
additionalProperties:
type: array
items:
$ref: '#/.../MyInternalMapDefinition'
What I don't like is this "MyInternalMapDefinition" definition. Is there anyway to define/model it as part of "MyGeneratedPojo"
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以在内部架构中进行内装:
You can inline the inner schema: