|
|
@@ -192,6 +192,18 @@ func (g *OpenAPIv3Generator) buildDocumentV3() *v3.Document {
|
|
|
servers = appendUnique(servers, path.Value.Patch.Servers[0].Url)
|
|
|
allServers = appendUnique(servers, path.Value.Patch.Servers[0].Url)
|
|
|
}
|
|
|
+ if path.Value.Head != nil && len(path.Value.Head.Servers) == 1 {
|
|
|
+ servers = appendUnique(servers, path.Value.Head.Servers[0].Url)
|
|
|
+ allServers = appendUnique(servers, path.Value.Head.Servers[0].Url)
|
|
|
+ }
|
|
|
+ if path.Value.Options != nil && len(path.Value.Options.Servers) == 1 {
|
|
|
+ servers = appendUnique(servers, path.Value.Options.Servers[0].Url)
|
|
|
+ allServers = appendUnique(servers, path.Value.Options.Servers[0].Url)
|
|
|
+ }
|
|
|
+ if path.Value.Trace != nil && len(path.Value.Trace.Servers) == 1 {
|
|
|
+ servers = appendUnique(servers, path.Value.Trace.Servers[0].Url)
|
|
|
+ allServers = appendUnique(servers, path.Value.Trace.Servers[0].Url)
|
|
|
+ }
|
|
|
|
|
|
if len(servers) == 1 {
|
|
|
path.Value.Servers = []*v3.Server{{Url: servers[0]}}
|
|
|
@@ -211,6 +223,15 @@ func (g *OpenAPIv3Generator) buildDocumentV3() *v3.Document {
|
|
|
if path.Value.Patch != nil {
|
|
|
path.Value.Patch.Servers = nil
|
|
|
}
|
|
|
+ if path.Value.Head != nil {
|
|
|
+ path.Value.Head.Servers = nil
|
|
|
+ }
|
|
|
+ if path.Value.Options != nil {
|
|
|
+ path.Value.Options.Servers = nil
|
|
|
+ }
|
|
|
+ if path.Value.Trace != nil {
|
|
|
+ path.Value.Trace.Servers = nil
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -707,6 +728,12 @@ func (g *OpenAPIv3Generator) addOperationToDocumentV3(d *v3.Document, op *v3.Ope
|
|
|
selectedPathItem.Value.Delete = op
|
|
|
case "PATCH":
|
|
|
selectedPathItem.Value.Patch = op
|
|
|
+ case http2.MethodHead:
|
|
|
+ selectedPathItem.Value.Head = op
|
|
|
+ case http2.MethodOptions:
|
|
|
+ selectedPathItem.Value.Options = op
|
|
|
+ case http2.MethodTrace:
|
|
|
+ selectedPathItem.Value.Trace = op
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -746,6 +773,12 @@ func (g *OpenAPIv3Generator) addPathsToDocumentV3(d *v3.Document, services []*pr
|
|
|
case *annotations.HttpRule_Put:
|
|
|
path = httpRule.Put
|
|
|
httpMethod = http2.MethodPut
|
|
|
+ case *annotations.HttpRule_Patch:
|
|
|
+ path = httpRule.Patch
|
|
|
+ httpMethod = http2.MethodPatch
|
|
|
+ case *annotations.HttpRule_Custom:
|
|
|
+ path = httpRule.Custom.Path
|
|
|
+ httpMethod = httpRule.Custom.Kind
|
|
|
}
|
|
|
if path == "" {
|
|
|
path = fmt.Sprintf("/api/%s/%s", service.Desc.FullName(), method.GoName)
|