Bumping k8s dependencies to 1.13

This commit is contained in:
Cheng Xing
2018-11-16 14:08:25 -08:00
parent 305407125c
commit b4c0b68ec7
8002 changed files with 884099 additions and 276228 deletions

View File

@@ -17,14 +17,17 @@
package main
import (
openapi2 "github.com/googleapis/gnostic/OpenAPIv2"
openapi3 "github.com/googleapis/gnostic/OpenAPIv3"
"log"
"github.com/golang/protobuf/proto"
openapiv2 "github.com/googleapis/gnostic/OpenAPIv2"
openapiv3 "github.com/googleapis/gnostic/OpenAPIv3"
plugins "github.com/googleapis/gnostic/plugins"
"github.com/googleapis/gnostic/printer"
)
// generate a simple report of an OpenAPI document's contents
func printDocumentV2(code *printer.Code, document *openapi2.Document) {
func printDocumentV2(code *printer.Code, document *openapiv2.Document) {
code.Print("Swagger: %+v", document.Swagger)
code.Print("Host: %+v", document.Host)
code.Print("BasePath: %+v", document.BasePath)
@@ -57,7 +60,7 @@ func printDocumentV2(code *printer.Code, document *openapi2.Document) {
}
// generate a simple report of an OpenAPI document's contents
func printDocumentV3(code *printer.Code, document *openapi3.Document) {
func printDocumentV3(code *printer.Code, document *openapiv3.Document) {
code.Print("OpenAPI: %+v", document.Openapi)
code.Print("Servers: %+v", document.Servers)
if document.Info != nil {
@@ -92,20 +95,28 @@ func printDocumentV3(code *printer.Code, document *openapi3.Document) {
func main() {
env, err := plugins.NewEnvironment()
env.RespondAndExitIfError(err)
code := &printer.Code{}
switch {
case env.Request.Openapi2 != nil:
printDocumentV2(code, env.Request.Openapi2)
case env.Request.Openapi3 != nil:
printDocumentV3(code, env.Request.Openapi3)
default:
for _, model := range env.Request.Models {
log.Printf("model %s", model.TypeUrl)
switch model.TypeUrl {
case "openapi.v2.Document":
documentv2 := &openapiv2.Document{}
err = proto.Unmarshal(model.Value, documentv2)
if err == nil {
printDocumentV2(code, documentv2)
}
case "openapi.v3.Document":
documentv3 := &openapiv3.Document{}
err = proto.Unmarshal(model.Value, documentv3)
if err == nil {
printDocumentV3(code, documentv3)
}
}
}
file := &plugins.File{
Name: "summary.txt",
Data: []byte(code.String()),
}
env.Response.Files = append(env.Response.Files, file)
env.RespondAndExit()
}