Bumping k8s dependencies to 1.13
This commit is contained in:
@@ -1,9 +1,13 @@
|
||||
// +build ignore
|
||||
// This file is omitted when getting with `go get github.com/googleapis/gnostic/...`
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/googleapis/gnostic/plugins/gnostic-go-generator/examples/v2.0/apis_guru/apis_guru"
|
||||
"sort"
|
||||
|
||||
"github.com/googleapis/gnostic/plugins/gnostic-go-generator/examples/v2.0/apis_guru/apis_guru"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
19
vendor/github.com/googleapis/gnostic/plugins/gnostic-go-generator/examples/v2.0/bookstore/bookstore/bookstore.go
generated
vendored
Normal file
19
vendor/github.com/googleapis/gnostic/plugins/gnostic-go-generator/examples/v2.0/bookstore/bookstore/bookstore.go
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
/*
|
||||
Copyright 2017 Google Inc. All Rights Reserved.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// Package bookstore exists to allow this repo to work with recursive go get.
|
||||
// It will be filled in with auto generated code.
|
||||
package bookstore
|
20
vendor/github.com/googleapis/gnostic/plugins/gnostic-go-generator/examples/v2.0/sample/Makefile
generated
vendored
Normal file
20
vendor/github.com/googleapis/gnostic/plugins/gnostic-go-generator/examples/v2.0/sample/Makefile
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
build:
|
||||
go get golang.org/x/tools/cmd/goimports
|
||||
go install github.com/googleapis/gnostic
|
||||
go install github.com/googleapis/gnostic/plugins/gnostic-go-generator
|
||||
rm -f $(GOPATH)/bin/gnostic-go-client $(GOPATH)/bin/gnostic-go-server
|
||||
ln -s $(GOPATH)/bin/gnostic-go-generator $(GOPATH)/bin/gnostic-go-client
|
||||
ln -s $(GOPATH)/bin/gnostic-go-generator $(GOPATH)/bin/gnostic-go-server
|
||||
|
||||
all: build
|
||||
gnostic sample.yaml --go-generator-out=sample
|
||||
|
||||
clean:
|
||||
rm -rf sample service/service
|
||||
|
||||
test: all
|
||||
killall service; true # ignore errors due to no matching processes
|
||||
cd service; go get .; go build; ./service &
|
||||
go test
|
||||
killall service
|
||||
|
24
vendor/github.com/googleapis/gnostic/plugins/gnostic-go-generator/examples/v2.0/sample/README.md
generated
vendored
Normal file
24
vendor/github.com/googleapis/gnostic/plugins/gnostic-go-generator/examples/v2.0/sample/README.md
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
# API Sample
|
||||
|
||||
This directory contains an OpenAPI description of a sample API
|
||||
that exercises various OpenAPI features.
|
||||
|
||||
Use this example to try the `gnostic-go-generator` plugin, which implements
|
||||
`gnostic-go-client` and `gnostic-go-server` for generating API client and
|
||||
server code, respectively.
|
||||
|
||||
Run "make all" to build and install `gnostic` and the Go plugins.
|
||||
It will generate both client and server code. The API client and
|
||||
server code will be in the `sample` package.
|
||||
|
||||
The `service` directory contains additional code that completes the server.
|
||||
To build and run the service, `cd service` and do the following:
|
||||
|
||||
go get .
|
||||
go build
|
||||
./service &
|
||||
|
||||
To test the service with the generated client, go back up to the top-level
|
||||
directory and run `go test`. The test in `sample_test.go` uses client
|
||||
code generated in `sample` to verify the service.
|
||||
|
67
vendor/github.com/googleapis/gnostic/plugins/gnostic-go-generator/examples/v2.0/sample/sample.yaml
generated
vendored
Normal file
67
vendor/github.com/googleapis/gnostic/plugins/gnostic-go-generator/examples/v2.0/sample/sample.yaml
generated
vendored
Normal file
@@ -0,0 +1,67 @@
|
||||
swagger: '2.0'
|
||||
schemes:
|
||||
- https
|
||||
host: sample.io
|
||||
basePath: /
|
||||
info:
|
||||
title: sample.io
|
||||
version: '1.0'
|
||||
consumes:
|
||||
- application/json
|
||||
produces:
|
||||
- application/json;charset=UTF-8
|
||||
securityDefinitions:
|
||||
api_key:
|
||||
in: query
|
||||
name: key
|
||||
type: apiKey
|
||||
paths:
|
||||
/sample/{id}:
|
||||
get:
|
||||
operationId: "GetSample"
|
||||
parameters:
|
||||
- description: identifier
|
||||
in: path
|
||||
name: id
|
||||
required: true
|
||||
type: string
|
||||
responses:
|
||||
'200':
|
||||
description: sample response
|
||||
schema:
|
||||
$ref: '#/definitions/Sample'
|
||||
'401':
|
||||
description: User doesn't have a valid session.
|
||||
schema:
|
||||
$ref: '#/definitions/APIError'
|
||||
'404':
|
||||
description: Unable to find supplied extractor ID.
|
||||
schema:
|
||||
$ref: '#/definitions/APIError'
|
||||
security:
|
||||
- api_key: []
|
||||
summary: Get a sample response
|
||||
tags:
|
||||
- sample
|
||||
- demo
|
||||
definitions:
|
||||
APIError:
|
||||
properties:
|
||||
code:
|
||||
description: Internal error code
|
||||
format: int
|
||||
type: integer
|
||||
message:
|
||||
description: A message containing a brief description of the error
|
||||
type: string
|
||||
type: object
|
||||
Sample:
|
||||
properties:
|
||||
id:
|
||||
type: string
|
||||
thing:
|
||||
type: object
|
||||
count:
|
||||
format: int32
|
||||
type: integer
|
||||
type: object
|
19
vendor/github.com/googleapis/gnostic/plugins/gnostic-go-generator/examples/v2.0/sample/sample/sample.go
generated
vendored
Normal file
19
vendor/github.com/googleapis/gnostic/plugins/gnostic-go-generator/examples/v2.0/sample/sample/sample.go
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
/*
|
||||
Copyright 2017 Google Inc. All Rights Reserved.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// Package sample exists to allow this repo to work with recursive go get.
|
||||
// It will be filled in with auto generated code.
|
||||
package sample
|
68
vendor/github.com/googleapis/gnostic/plugins/gnostic-go-generator/examples/v2.0/sample/sample_test.go
generated
vendored
Normal file
68
vendor/github.com/googleapis/gnostic/plugins/gnostic-go-generator/examples/v2.0/sample/sample_test.go
generated
vendored
Normal file
@@ -0,0 +1,68 @@
|
||||
/*
|
||||
Copyright 2018 Google Inc. All Rights Reserved.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package test
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/googleapis/gnostic/plugins/gnostic-go-generator/examples/v2.0/sample/sample"
|
||||
)
|
||||
|
||||
const service = "http://localhost:8080"
|
||||
|
||||
func TestSample(t *testing.T) {
|
||||
// create a client
|
||||
s := sample.NewClient(service, nil)
|
||||
// verify a sample request
|
||||
{
|
||||
message := "hello world"
|
||||
response, err := s.GetSample(message)
|
||||
if err != nil {
|
||||
t.Log("get sample failed")
|
||||
t.Fail()
|
||||
}
|
||||
if response.OK.Id != message || response.OK.Count != int32(len(message)) {
|
||||
t.Log(fmt.Sprintf("get sample received %+v", response.OK))
|
||||
t.Fail()
|
||||
}
|
||||
if (response == nil) || (response.OK == nil) {
|
||||
t.Log(fmt.Sprintf("get sample failed %+v", response.OK))
|
||||
t.Fail()
|
||||
}
|
||||
}
|
||||
// verify the handling of an invalid request
|
||||
{
|
||||
req, err := http.NewRequest("GET", service+"/unsupported", strings.NewReader(""))
|
||||
if err != nil {
|
||||
t.Log("bad request failed")
|
||||
return
|
||||
}
|
||||
resp, err := http.DefaultClient.Do(req)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
// we expect a 404 (Not Found) code
|
||||
if resp.StatusCode != 404 {
|
||||
t.Log("bad request failed")
|
||||
t.Fail()
|
||||
}
|
||||
return
|
||||
}
|
||||
}
|
9
vendor/github.com/googleapis/gnostic/plugins/gnostic-go-generator/examples/v2.0/sample/service/app.yaml
generated
vendored
Normal file
9
vendor/github.com/googleapis/gnostic/plugins/gnostic-go-generator/examples/v2.0/sample/service/app.yaml
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
application: sample
|
||||
version: 1
|
||||
runtime: go
|
||||
api_version: go1
|
||||
handlers:
|
||||
- url: /.*
|
||||
script: _go_app
|
||||
- url: /
|
||||
static_dir: static
|
27
vendor/github.com/googleapis/gnostic/plugins/gnostic-go-generator/examples/v2.0/sample/service/init.go
generated
vendored
Normal file
27
vendor/github.com/googleapis/gnostic/plugins/gnostic-go-generator/examples/v2.0/sample/service/init.go
generated
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
Copyright 2018 Google Inc. All Rights Reserved.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"github.com/googleapis/gnostic/plugins/gnostic-go-generator/examples/v2.0/sample/sample"
|
||||
)
|
||||
|
||||
// init() is called when the package is loaded
|
||||
// this allows this app to be trivially deployed to Google App Engine, which does not call main()
|
||||
func init() {
|
||||
sample.Initialize(NewService())
|
||||
}
|
34
vendor/github.com/googleapis/gnostic/plugins/gnostic-go-generator/examples/v2.0/sample/service/main.go
generated
vendored
Normal file
34
vendor/github.com/googleapis/gnostic/plugins/gnostic-go-generator/examples/v2.0/sample/service/main.go
generated
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
// +build !appengine
|
||||
|
||||
// This file is omitted when the app is built for Google App Engine
|
||||
|
||||
/*
|
||||
Copyright 2018 Google Inc. All Rights Reserved.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"log"
|
||||
|
||||
"github.com/googleapis/gnostic/plugins/gnostic-go-generator/examples/v2.0/sample/sample"
|
||||
)
|
||||
|
||||
func main() {
|
||||
err := sample.ServeHTTP(":8080")
|
||||
if err != nil {
|
||||
log.Printf("%v", err)
|
||||
}
|
||||
}
|
38
vendor/github.com/googleapis/gnostic/plugins/gnostic-go-generator/examples/v2.0/sample/service/service.go
generated
vendored
Normal file
38
vendor/github.com/googleapis/gnostic/plugins/gnostic-go-generator/examples/v2.0/sample/service/service.go
generated
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
Copyright 2018 Google Inc. All Rights Reserved.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"github.com/googleapis/gnostic/plugins/gnostic-go-generator/examples/v2.0/sample/sample"
|
||||
)
|
||||
|
||||
//
|
||||
// The Service type implements a sample service.
|
||||
//
|
||||
type Service struct{}
|
||||
|
||||
func NewService() *Service {
|
||||
return &Service{}
|
||||
}
|
||||
|
||||
func (service *Service) GetSample(parameters *sample.GetSampleParameters, responses *sample.GetSampleResponses) (err error) {
|
||||
(*responses).OK = &sample.Sample{
|
||||
Id: parameters.Id,
|
||||
Thing: map[string]interface{}{"thing": 123},
|
||||
Count: int32(len(parameters.Id))}
|
||||
return err
|
||||
}
|
@@ -2,6 +2,7 @@ package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/googleapis/gnostic/plugins/gnostic-go-generator/examples/v2.0/xkcd/xkcd"
|
||||
)
|
||||
|
||||
|
19
vendor/github.com/googleapis/gnostic/plugins/gnostic-go-generator/examples/v2.0/xkcd/xkcd/xkcd.go
generated
vendored
Normal file
19
vendor/github.com/googleapis/gnostic/plugins/gnostic-go-generator/examples/v2.0/xkcd/xkcd/xkcd.go
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
/*
|
||||
Copyright 2017 Google Inc. All Rights Reserved.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// Package xkcd exists to allow this repo to work with recursive go get.
|
||||
// It will be filled in with auto generated code.
|
||||
package xkcd
|
19
vendor/github.com/googleapis/gnostic/plugins/gnostic-go-generator/examples/v3.0/bookstore/bookstore/bookstore.go
generated
vendored
Normal file
19
vendor/github.com/googleapis/gnostic/plugins/gnostic-go-generator/examples/v3.0/bookstore/bookstore/bookstore.go
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
/*
|
||||
Copyright 2017 Google Inc. All Rights Reserved.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// Package bookstore exists to allow this repo to work with recursive go get.
|
||||
// It will be filled in with auto generated code.
|
||||
package bookstore
|
19
vendor/github.com/googleapis/gnostic/plugins/gnostic-go-generator/examples/v3.0/urlshortener/urlshortener/urlshortener.go
generated
vendored
Normal file
19
vendor/github.com/googleapis/gnostic/plugins/gnostic-go-generator/examples/v3.0/urlshortener/urlshortener/urlshortener.go
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
/*
|
||||
Copyright 2017 Google Inc. All Rights Reserved.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// Package urlshortener exists to allow this repo to work with recursive go get.
|
||||
// It will be filled in with auto generated code.
|
||||
package urlshortener
|
6
vendor/github.com/googleapis/gnostic/plugins/gnostic-go-generator/language.go
generated
vendored
6
vendor/github.com/googleapis/gnostic/plugins/gnostic-go-generator/language.go
generated
vendored
@@ -16,8 +16,8 @@ package main
|
||||
|
||||
import (
|
||||
surface "github.com/googleapis/gnostic/surface"
|
||||
"unicode"
|
||||
"strings"
|
||||
"unicode"
|
||||
)
|
||||
|
||||
type GoLanguageModel struct{}
|
||||
@@ -49,7 +49,7 @@ func (language *GoLanguageModel) Prepare(model *surface.Model) {
|
||||
f.NativeType = "int64"
|
||||
}
|
||||
case "object":
|
||||
f.NativeType = "{}interface"
|
||||
f.NativeType = "interface{}"
|
||||
case "string":
|
||||
f.NativeType = "string"
|
||||
default:
|
||||
@@ -88,6 +88,8 @@ func goFieldName(name string) string {
|
||||
// avoid integers
|
||||
if name == "200" {
|
||||
return "OK"
|
||||
} else if unicode.IsDigit(rune(name[0])) {
|
||||
return "Code" + name
|
||||
}
|
||||
return name
|
||||
}
|
||||
|
51
vendor/github.com/googleapis/gnostic/plugins/gnostic-go-generator/main.go
generated
vendored
51
vendor/github.com/googleapis/gnostic/plugins/gnostic-go-generator/main.go
generated
vendored
@@ -21,7 +21,9 @@ import (
|
||||
"errors"
|
||||
"strings"
|
||||
|
||||
"github.com/golang/protobuf/proto"
|
||||
plugins "github.com/googleapis/gnostic/plugins"
|
||||
surface "github.com/googleapis/gnostic/surface"
|
||||
)
|
||||
|
||||
// This is the main function for the code generation plugin.
|
||||
@@ -42,30 +44,33 @@ func main() {
|
||||
files = []string{"client.go", "server.go", "provider.go", "types.go", "constants.go"}
|
||||
}
|
||||
|
||||
// Get the code surface model.
|
||||
model := env.Request.Surface
|
||||
for _, model := range env.Request.Models {
|
||||
switch model.TypeUrl {
|
||||
case "surface.v1.Model":
|
||||
surfaceModel := &surface.Model{}
|
||||
err = proto.Unmarshal(model.Value, surfaceModel)
|
||||
if err == nil {
|
||||
// Customize the code surface model for Go
|
||||
NewGoLanguageModel().Prepare(surfaceModel)
|
||||
|
||||
if model == nil {
|
||||
err = errors.New("No generated code surface model is available.")
|
||||
env.RespondAndExitIfError(err)
|
||||
modelJSON, _ := json.MarshalIndent(surfaceModel, "", " ")
|
||||
modelFile := &plugins.File{Name: "model.json", Data: modelJSON}
|
||||
env.Response.Files = append(env.Response.Files, modelFile)
|
||||
|
||||
// Create the renderer.
|
||||
renderer, err := NewServiceRenderer(surfaceModel)
|
||||
renderer.Package = packageName
|
||||
env.RespondAndExitIfError(err)
|
||||
|
||||
// Run the renderer to generate files and add them to the response object.
|
||||
err = renderer.Render(env.Response, files)
|
||||
env.RespondAndExitIfError(err)
|
||||
|
||||
// Return with success.
|
||||
env.RespondAndExit()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Customize the code surface model for Go
|
||||
NewGoLanguageModel().Prepare(model)
|
||||
|
||||
modelJSON, _ := json.MarshalIndent(model, "", " ")
|
||||
modelFile := &plugins.File{Name: "model.json", Data: modelJSON}
|
||||
env.Response.Files = append(env.Response.Files, modelFile)
|
||||
|
||||
// Create the renderer.
|
||||
renderer, err := NewServiceRenderer(model)
|
||||
renderer.Package = packageName
|
||||
err = errors.New("No generated code surface model is available.")
|
||||
env.RespondAndExitIfError(err)
|
||||
|
||||
// Run the renderer to generate files and add them to the response object.
|
||||
err = renderer.Render(env.Response, files)
|
||||
env.RespondAndExitIfError(err)
|
||||
|
||||
// Return with success.
|
||||
env.RespondAndExit()
|
||||
}
|
||||
|
4
vendor/github.com/googleapis/gnostic/plugins/gnostic-go-generator/render_client.go
generated
vendored
4
vendor/github.com/googleapis/gnostic/plugins/gnostic-go-generator/render_client.go
generated
vendored
@@ -109,7 +109,9 @@ func (renderer *Renderer) RenderClient() ([]byte, error) {
|
||||
|
||||
if method.Method == "POST" {
|
||||
f.WriteLine(`body := new(bytes.Buffer)`)
|
||||
f.WriteLine(`json.NewEncoder(body).Encode(` + parametersType.FieldWithPosition(surface.Position_BODY).Name + `)`)
|
||||
if parametersType != nil {
|
||||
f.WriteLine(`json.NewEncoder(body).Encode(` + parametersType.FieldWithPosition(surface.Position_BODY).Name + `)`)
|
||||
}
|
||||
f.WriteLine(`req, err := http.NewRequest("` + method.Method + `", path, body)`)
|
||||
f.WriteLine(`reqHeaders := make(http.Header)`)
|
||||
f.WriteLine(`reqHeaders.Set("Content-Type", "application/json")`)
|
||||
|
2
vendor/github.com/googleapis/gnostic/plugins/gnostic-go-generator/render_types.go
generated
vendored
2
vendor/github.com/googleapis/gnostic/plugins/gnostic-go-generator/render_types.go
generated
vendored
@@ -43,7 +43,7 @@ func (renderer *Renderer) RenderTypes() ([]byte, error) {
|
||||
} else if modelType.Kind == surface.TypeKind_OBJECT {
|
||||
f.WriteLine(`type ` + modelType.TypeName + ` map[string]` + modelType.ContentType)
|
||||
} else {
|
||||
f.WriteLine(`type ` + modelType.TypeName + ` struct {}`)
|
||||
f.WriteLine(`type ` + modelType.TypeName + ` interface {}`)
|
||||
}
|
||||
}
|
||||
return f.Bytes(), nil
|
||||
|
Reference in New Issue
Block a user