fix for empty default response
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
parent
e6b8324395
commit
41e32e36b3
@ -653,9 +653,10 @@ func (g *openapiv3Generator) buildOperationV3(
|
|||||||
opt := eopt.(*v3.Operation)
|
opt := eopt.(*v3.Operation)
|
||||||
if r := opt.Responses; r != nil {
|
if r := opt.Responses; r != nil {
|
||||||
responses = r
|
responses = r
|
||||||
}
|
|
||||||
|
|
||||||
if ref := responses.Default.GetReference(); ref != nil && ref.GetXRef() != "" {
|
rd := responses.Default
|
||||||
|
if rd != nil {
|
||||||
|
if ref := rd.GetReference(); ref != nil && ref.GetXRef() != "" {
|
||||||
xref := strings.TrimPrefix(ref.GetXRef(), ".")
|
xref := strings.TrimPrefix(ref.GetXRef(), ".")
|
||||||
description := "Default"
|
description := "Default"
|
||||||
if strings.Contains(xref, "micro.errors.Error") {
|
if strings.Contains(xref, "micro.errors.Error") {
|
||||||
@ -675,6 +676,7 @@ func (g *openapiv3Generator) buildOperationV3(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
for _, rref := range responses.GetResponseOrReference() {
|
for _, rref := range responses.GetResponseOrReference() {
|
||||||
if ref := rref.Value.GetReference(); ref != nil && ref.GetXRef() != "" {
|
if ref := rref.Value.GetReference(); ref != nil && ref.GetXRef() != "" {
|
||||||
xref := strings.TrimPrefix(ref.GetXRef(), ".")
|
xref := strings.TrimPrefix(ref.GetXRef(), ".")
|
||||||
@ -700,6 +702,9 @@ func (g *openapiv3Generator) buildOperationV3(
|
|||||||
} else {
|
} else {
|
||||||
responses = &v3.Responses{}
|
responses = &v3.Responses{}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
responses = &v3.Responses{}
|
||||||
|
}
|
||||||
|
|
||||||
// Create the response.
|
// Create the response.
|
||||||
responses.ResponseOrReference = append(responses.ResponseOrReference, &v3.NamedResponseOrReference{
|
responses.ResponseOrReference = append(responses.ResponseOrReference, &v3.NamedResponseOrReference{
|
||||||
|
@ -16,8 +16,8 @@ var (
|
|||||||
microServerPackage = protogen.GoImportPath("go.unistack.org/micro/v3/server")
|
microServerPackage = protogen.GoImportPath("go.unistack.org/micro/v3/server")
|
||||||
microClientHttpPackage = protogen.GoImportPath("go.unistack.org/micro-client-http/v3")
|
microClientHttpPackage = protogen.GoImportPath("go.unistack.org/micro-client-http/v3")
|
||||||
microServerHttpPackage = protogen.GoImportPath("go.unistack.org/micro-server-http/v3")
|
microServerHttpPackage = protogen.GoImportPath("go.unistack.org/micro-server-http/v3")
|
||||||
microCodecPackage = protogen.GoImportPath("go.unistack.org/micro-proto/v3/codec")
|
microCodecPackage = protogen.GoImportPath("go.unistack.org/micro/v3/codec")
|
||||||
microErrorsPackage = protogen.GoImportPath("go.unistack.org/micro-proto/v3/errors")
|
microErrorsPackage = protogen.GoImportPath("go.unistack.org/micro/v3/errors")
|
||||||
timePackage = protogen.GoImportPath("time")
|
timePackage = protogen.GoImportPath("time")
|
||||||
deprecationComment = "// Deprecated: Do not use."
|
deprecationComment = "// Deprecated: Do not use."
|
||||||
versionComment = "v3.5.3"
|
versionComment = "v3.5.3"
|
||||||
|
Loading…
Reference in New Issue
Block a user