我有响应结构:
responses:
'200':
description: OK
content:
application/json:
schema:
type: object
properties:
data:
allOf:
- { $ref: ../../components/schemas/Product.yaml }
example:
active: false
Run Code Online (Sandbox Code Playgroud)
还有 Product.yaml 之一:
type: object
description: Product
properties:
id:
description: ID
type: integer
example: 1
name:
description: Name
type: string
example: 'fresh baguette'
active:
description: Is active
type: boolean
example: true
Run Code Online (Sandbox Code Playgroud)
所以我想覆盖活动示例,当我这样做时:
data:
allOf:
- { $ref: ../../components/schemas/Product.yaml }
example:
active: false
Run Code Online (Sandbox Code Playgroud)
在“响应示例”下的 redoc ui 中,我看到唯一的活动属性。
我的问题是如何在不覆盖每个产品属性的情况下覆盖仅活动属性的示例?
我在进行本地开发时使用“替换”语句。所以我的 go.mod 看起来像这样:
require (
gorm.io/gorm v1.21.11
github.com/mypackages/session v1.1.0
)
replace (
github.com/mypackages/session => ./../session
)
Run Code Online (Sandbox Code Playgroud)
但是当git commit
我更改并将代码部署到生产时,我不需要“替换” ,所以我需要在每个替换代码上注释这行替换代码,git commit
然后取消注释。有没有办法忽略生产环境中的“替换”语句?