forked from loafle/openapi-generator-original
[Golang] Move utility functions from client.mustache to utils.mustache (#19001)
* [Golang] Move utility functions from client.mustache to utils.mustache * re-generate Go samples * re-generate Go samples again * re-generate samples once more * update go samples --------- Co-authored-by: Martin Lakov <martin.lakov@ocado.com>
This commit is contained in:
@@ -519,18 +519,6 @@ func addFile(w *multipart.Writer, fieldName, path string) error {
|
||||
return err
|
||||
}
|
||||
|
||||
// Prevent trying to import "fmt"
|
||||
func reportError(format string, a ...interface{}) error {
|
||||
return fmt.Errorf(format, a...)
|
||||
}
|
||||
|
||||
// A wrapper for strict JSON decoding
|
||||
func newStrictDecoder(data []byte) *json.Decoder {
|
||||
dec := json.NewDecoder(bytes.NewBuffer(data))
|
||||
dec.DisallowUnknownFields()
|
||||
return dec
|
||||
}
|
||||
|
||||
// Set request body from an interface{}
|
||||
func setBody(body interface{}, contentType string) (bodyBuf *bytes.Buffer, err error) {
|
||||
if bodyBuf == nil {
|
||||
|
||||
@@ -12,7 +12,9 @@ Contact: team@openapitools.org
|
||||
package openapi
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"reflect"
|
||||
"time"
|
||||
)
|
||||
@@ -346,3 +348,15 @@ func IsNil(i interface{}) bool {
|
||||
type MappedNullable interface {
|
||||
ToMap() (map[string]interface{}, error)
|
||||
}
|
||||
|
||||
// A wrapper for strict JSON decoding
|
||||
func newStrictDecoder(data []byte) *json.Decoder {
|
||||
dec := json.NewDecoder(bytes.NewBuffer(data))
|
||||
dec.DisallowUnknownFields()
|
||||
return dec
|
||||
}
|
||||
|
||||
// Prevent trying to import "fmt"
|
||||
func reportError(format string, a ...interface{}) error {
|
||||
return fmt.Errorf(format, a...)
|
||||
}
|
||||
Reference in New Issue
Block a user