问题描述
我希望我的OpenAPI 3.0.1规范具有一定的继承性,比如说基本类型Input
和两个子类型SelectInput
和TextInput
,这是规范:>
SelectInput:
type: object
allOf:
- $ref: '#/components/schemas/Input'
properties:
options:
type: array
items:
$ref: '#/components/schemas/Option'
TextInput:
type: object
allOf:
- $ref: '#/components/schemas/Input'
properties:
text:
type: string
Input:
type: object
properties:
key:
type: string
title:
type: string
value:
type: string
description: ''
additionalProperties: false
Row:
type: object
properties:
inputs:
type: array
items:
oneOf:
- $ref: '#/components/schemas/Input'
- $ref: '#/components/schemas/TextInput'
- $ref: '#/components/schemas/SelectInput'
description: ''
现在,生成aspnetcore服务器,除了创建一个新类-AnyOfRowInputItems
之外,这些模型看起来还不错。如果我去Row类,它现在具有List而不是基本类型Input
,并且不仅如此而且AnyOfRowInputItems
根本没有属性,只有一些JSON帮助器方法。这是正常行为吗,因为我不了解,这是什么主意?另外,如果没有生成逻辑来区分这三种类型,规范的oneOf
部分对代码生成有何作用?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)