如何解决Openapi 3.0:有效负载不反映我的架构 allOf
我有一点麻烦:在 yaml 中,我将创建一个包含一些文件的通用模式。然后我会在各种 PUT\POST 调用中引用它。 在每个 put\post 中,我将创建这个特定模式的特化,包括 allOf。 所以,就立场而言,这是我的架构
site:
type: object
properties:
id:
type: integer
readOnly: true
description:
type: string
idLicensee:
type: integer
uId:
type: string
active:
type: boolean
lastupdate:
type: string
format: date-time
readOnly: true
这是我的 PUT
put:
tags:
- sites
operationId: editSite
parameters:
- name: id
in: path
description: "id of the object to be removed"
required: true
schema:
type: integer
requestBody:
description: "Use this message to edit an existing site"
content:
application/json:
schema:
allOf:
- type: object
properties:
uId:
readOnly: true
idLicensee:
readOnly: true
- required:
- description
- active
- $ref: '#/components/schemas/site'
现在我终于在我的编译文档中看到,一个正确的请求正文只需要 2 个字段,同时使用类似的 Sitanx,我可以创建一个正确的 POST 需要 4 个字段。
我的payload没有反映allOf“覆盖”(抱歉这个条款,我是初级开发人员
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。