我用go-swagger
. 我有这样的模型:
// Pet pet
// swagger:model
type Pet struct {
// id
ID int64 `json:"id,omitempty"`
// name
// Required: true
Name *string `json:"name"`
}
例如在我的POST字段Name
中必须是必需的,但对于GET不是。那么如果我不想在不需要的情况下创建类似的模型,我应该如何添加它?因为现在我唯一的想法是创造type PetGET struct
,type PetPOST struct
我想这是愚蠢的想法。