我是Swagger的初学者,我正在尝试定义具有以下内容的端点:
我正在做的是定义以下模型:
ResourceBaseModel: type: object properties: shared_properties: type: string
ResourceCollectionResponse: type: array items: type: object allOf: - $ref: ResourceBaseModel - type: object properties: collection_normal_properties: type: string collection_read_only_properties: type: string readOnly: true
ResourceDetailResponse: type: object allOf: - $ref: ResourceBaseModel - type: object properties: detail_normal_properties: type: string detail_read_only_properties: type: string readOnly: true
ResourceRequest: type: object allOf: - $ref: ResourceBaseModel - type: object properties: request_write_only_properties: type: string
这使得每个模型定义了4次,我觉得效率不高。
所以这是我的问题:
我想知道是否有一天我只能定义一个模型来描述所有模型,或者您认为可以编译为Swagger YAML的创新语言能够使整个社区受益吗?就像Sass / LESS如何构建CSS一样?
感谢您的帮助和见解!