go-zero
go-zero copied to clipboard
generates nested types in doc
Provides the ability to generate nested types like
type CommonResponse {
Code int `json:"code"` // 100 | 200
Message string `json:"message"`
}
type UserCreateDto {
Id string `json:"id"`
}
type UserCreateResponse {
CommonResponse
Result *UserCreateDto `json:"result"` // result
}
is generate to
type UserCreateResponse struct {
Code int `json:"code"` // 100 | 200
Message string `json:"message"`
Result struct {
Id string `json:"id"`
} `json:"result"` // result
}
How can we know when to be nested or not?
i use this spec.ApiSpec.Types to determine whether it is a golang built-in type, and if it is, then call getRefProperty
to generate the nested types
Use #2368 instead