首页 > 解决方案 > go-swagger 将数字注入属性名称

问题描述

我拥有的 models.yaml 文件是:

baseStorePatch:
    title: Store
    type: object
    required:
      - scalePolicy
    properties:
      scalePolicy:
          $ref: "#/definitions/scalePolicy"
StorePatch:
    allOf:
      - $ref: "#/definitions/baseStorePatch"
      - type: object
        properties:

但是,当我使用 go-swagger 生成客户端时,输出为:

type StorePatch struct {
    ScalePolicy *StorePatchAO0ScalePolicy `json:"scalePolicy,omitempty"`
}

为什么 go-swagger 会自动生成StorePatchAO0前缀?以及如何摆脱它?

标签: openapigo-swagger

解决方案


推荐阅读