From c5c06db46509de256148e395d13cb942f6b34d36 Mon Sep 17 00:00:00 2001 From: Marcin Romaszewicz Date: Tue, 19 May 2026 09:09:53 -0700 Subject: [PATCH] Echo V5 now uses the generic test framework When I updated to Go 1.25 and un-moduled the echo-v5 code, I left behind the special-cased test for echo-v5 which existed due to module boundaries. Since those modules don't exist anymore, we can remove the special casing. Co-Authored-By: Claude Opus 4.7 (1M context) --- .../test/parameters/echov5/client.cfg.yaml | 5 - internal/test/parameters/echov5/client.gen.go | 3378 ----------------- .../parameters/echov5/echov5_param_test.go | 381 -- .../parameters/echov5/{ => gen}/server.gen.go | 4 +- .../parameters/echov5/{ => gen}/types.gen.go | 4 +- .../test/parameters/echov5/server.cfg.yaml | 4 +- internal/test/parameters/echov5/server.go | 59 +- .../test/parameters/echov5/types.cfg.yaml | 4 +- .../test/parameters/param_roundtrip_test.go | 10 + 9 files changed, 49 insertions(+), 3800 deletions(-) delete mode 100644 internal/test/parameters/echov5/client.cfg.yaml delete mode 100644 internal/test/parameters/echov5/client.gen.go delete mode 100644 internal/test/parameters/echov5/echov5_param_test.go rename internal/test/parameters/echov5/{ => gen}/server.gen.go (99%) rename internal/test/parameters/echov5/{ => gen}/types.gen.go (97%) diff --git a/internal/test/parameters/echov5/client.cfg.yaml b/internal/test/parameters/echov5/client.cfg.yaml deleted file mode 100644 index 79dabbe746..0000000000 --- a/internal/test/parameters/echov5/client.cfg.yaml +++ /dev/null @@ -1,5 +0,0 @@ -# yaml-language-server: $schema=../../../../configuration-schema.json -package: echov5params -generate: - client: true -output: client.gen.go diff --git a/internal/test/parameters/echov5/client.gen.go b/internal/test/parameters/echov5/client.gen.go deleted file mode 100644 index a6b498d5ec..0000000000 --- a/internal/test/parameters/echov5/client.gen.go +++ /dev/null @@ -1,3378 +0,0 @@ -// Package echov5params provides primitives to interact with the openapi HTTP API. -// -// Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.0.0-00010101000000-000000000000 DO NOT EDIT. -package echov5params - -import ( - "context" - "encoding/json" - "fmt" - "io" - "net/http" - "net/url" - "strings" - - "github.com/oapi-codegen/runtime" -) - -// RequestEditorFn is the function signature for the RequestEditor callback function -type RequestEditorFn func(ctx context.Context, req *http.Request) error - -// Doer performs HTTP requests. -// -// The standard http.Client implements this interface. -type HttpRequestDoer interface { - Do(req *http.Request) (*http.Response, error) -} - -// Client which conforms to the OpenAPI3 specification for this service. -type Client struct { - // The endpoint of the server conforming to this interface, with scheme, - // https://api.deepmap.com for example. This can contain a path relative - // to the server, such as https://api.deepmap.com/dev-test, and all the - // paths in the swagger spec will be appended to the server. - Server string - - // Doer for performing requests, typically a *http.Client with any - // customized settings, such as certificate chains. - Client HttpRequestDoer - - // A list of callbacks for modifying requests which are generated before sending over - // the network. - RequestEditors []RequestEditorFn -} - -// ClientOption allows setting custom parameters during construction -type ClientOption func(*Client) error - -// Creates a new Client, with reasonable defaults -func NewClient(server string, opts ...ClientOption) (*Client, error) { - // create a client with sane default values - client := Client{ - Server: server, - } - // mutate client and add all optional params - for _, o := range opts { - if err := o(&client); err != nil { - return nil, err - } - } - // ensure the server URL always has a trailing slash - if !strings.HasSuffix(client.Server, "/") { - client.Server += "/" - } - // create httpClient, if not already present - if client.Client == nil { - client.Client = &http.Client{} - } - return &client, nil -} - -// WithHTTPClient allows overriding the default Doer, which is -// automatically created using http.Client. This is useful for tests. -func WithHTTPClient(doer HttpRequestDoer) ClientOption { - return func(c *Client) error { - c.Client = doer - return nil - } -} - -// WithRequestEditorFn allows setting up a callback function, which will be -// called right before sending the request. This can be used to mutate the request. -func WithRequestEditorFn(fn RequestEditorFn) ClientOption { - return func(c *Client) error { - c.RequestEditors = append(c.RequestEditors, fn) - return nil - } -} - -// The interface specification for the client above. -type ClientInterface interface { - // GetContentObject request - GetContentObject(ctx context.Context, param ComplexObject, reqEditors ...RequestEditorFn) (*http.Response, error) - - // GetCookie request - GetCookie(ctx context.Context, params *GetCookieParams, reqEditors ...RequestEditorFn) (*http.Response, error) - - // EnumParams request - EnumParams(ctx context.Context, params *EnumParamsParams, reqEditors ...RequestEditorFn) (*http.Response, error) - - // GetHeader request - GetHeader(ctx context.Context, params *GetHeaderParams, reqEditors ...RequestEditorFn) (*http.Response, error) - - // GetLabelExplodeArray request - GetLabelExplodeArray(ctx context.Context, param []int32, reqEditors ...RequestEditorFn) (*http.Response, error) - - // GetLabelExplodeObject request - GetLabelExplodeObject(ctx context.Context, param Object, reqEditors ...RequestEditorFn) (*http.Response, error) - - // GetLabelExplodePrimitive request - GetLabelExplodePrimitive(ctx context.Context, param int32, reqEditors ...RequestEditorFn) (*http.Response, error) - - // GetLabelNoExplodeArray request - GetLabelNoExplodeArray(ctx context.Context, param []int32, reqEditors ...RequestEditorFn) (*http.Response, error) - - // GetLabelNoExplodeObject request - GetLabelNoExplodeObject(ctx context.Context, param Object, reqEditors ...RequestEditorFn) (*http.Response, error) - - // GetLabelPrimitive request - GetLabelPrimitive(ctx context.Context, param int32, reqEditors ...RequestEditorFn) (*http.Response, error) - - // GetMatrixExplodeArray request - GetMatrixExplodeArray(ctx context.Context, id []int32, reqEditors ...RequestEditorFn) (*http.Response, error) - - // GetMatrixExplodeObject request - GetMatrixExplodeObject(ctx context.Context, id Object, reqEditors ...RequestEditorFn) (*http.Response, error) - - // GetMatrixExplodePrimitive request - GetMatrixExplodePrimitive(ctx context.Context, id int32, reqEditors ...RequestEditorFn) (*http.Response, error) - - // GetMatrixNoExplodeArray request - GetMatrixNoExplodeArray(ctx context.Context, id []int32, reqEditors ...RequestEditorFn) (*http.Response, error) - - // GetMatrixNoExplodeObject request - GetMatrixNoExplodeObject(ctx context.Context, id Object, reqEditors ...RequestEditorFn) (*http.Response, error) - - // GetMatrixPrimitive request - GetMatrixPrimitive(ctx context.Context, id int32, reqEditors ...RequestEditorFn) (*http.Response, error) - - // GetPassThrough request - GetPassThrough(ctx context.Context, param string, reqEditors ...RequestEditorFn) (*http.Response, error) - - // GetDeepObject request - GetDeepObject(ctx context.Context, params *GetDeepObjectParams, reqEditors ...RequestEditorFn) (*http.Response, error) - - // GetQueryDelimited request - GetQueryDelimited(ctx context.Context, params *GetQueryDelimitedParams, reqEditors ...RequestEditorFn) (*http.Response, error) - - // GetQueryForm request - GetQueryForm(ctx context.Context, params *GetQueryFormParams, reqEditors ...RequestEditorFn) (*http.Response, error) - - // GetSimpleExplodeArray request - GetSimpleExplodeArray(ctx context.Context, param []int32, reqEditors ...RequestEditorFn) (*http.Response, error) - - // GetSimpleExplodeObject request - GetSimpleExplodeObject(ctx context.Context, param Object, reqEditors ...RequestEditorFn) (*http.Response, error) - - // GetSimpleExplodePrimitive request - GetSimpleExplodePrimitive(ctx context.Context, param int32, reqEditors ...RequestEditorFn) (*http.Response, error) - - // GetSimpleNoExplodeArray request - GetSimpleNoExplodeArray(ctx context.Context, param []int32, reqEditors ...RequestEditorFn) (*http.Response, error) - - // GetSimpleNoExplodeObject request - GetSimpleNoExplodeObject(ctx context.Context, param Object, reqEditors ...RequestEditorFn) (*http.Response, error) - - // GetSimplePrimitive request - GetSimplePrimitive(ctx context.Context, param int32, reqEditors ...RequestEditorFn) (*http.Response, error) - - // GetStartingWithNumber request - GetStartingWithNumber(ctx context.Context, n1param string, reqEditors ...RequestEditorFn) (*http.Response, error) -} - -func (c *Client) GetContentObject(ctx context.Context, param ComplexObject, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewGetContentObjectRequest(c.Server, param) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) GetCookie(ctx context.Context, params *GetCookieParams, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewGetCookieRequest(c.Server, params) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) EnumParams(ctx context.Context, params *EnumParamsParams, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewEnumParamsRequest(c.Server, params) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) GetHeader(ctx context.Context, params *GetHeaderParams, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewGetHeaderRequest(c.Server, params) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) GetLabelExplodeArray(ctx context.Context, param []int32, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewGetLabelExplodeArrayRequest(c.Server, param) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) GetLabelExplodeObject(ctx context.Context, param Object, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewGetLabelExplodeObjectRequest(c.Server, param) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) GetLabelExplodePrimitive(ctx context.Context, param int32, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewGetLabelExplodePrimitiveRequest(c.Server, param) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) GetLabelNoExplodeArray(ctx context.Context, param []int32, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewGetLabelNoExplodeArrayRequest(c.Server, param) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) GetLabelNoExplodeObject(ctx context.Context, param Object, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewGetLabelNoExplodeObjectRequest(c.Server, param) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) GetLabelPrimitive(ctx context.Context, param int32, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewGetLabelPrimitiveRequest(c.Server, param) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) GetMatrixExplodeArray(ctx context.Context, id []int32, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewGetMatrixExplodeArrayRequest(c.Server, id) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) GetMatrixExplodeObject(ctx context.Context, id Object, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewGetMatrixExplodeObjectRequest(c.Server, id) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) GetMatrixExplodePrimitive(ctx context.Context, id int32, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewGetMatrixExplodePrimitiveRequest(c.Server, id) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) GetMatrixNoExplodeArray(ctx context.Context, id []int32, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewGetMatrixNoExplodeArrayRequest(c.Server, id) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) GetMatrixNoExplodeObject(ctx context.Context, id Object, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewGetMatrixNoExplodeObjectRequest(c.Server, id) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) GetMatrixPrimitive(ctx context.Context, id int32, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewGetMatrixPrimitiveRequest(c.Server, id) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) GetPassThrough(ctx context.Context, param string, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewGetPassThroughRequest(c.Server, param) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) GetDeepObject(ctx context.Context, params *GetDeepObjectParams, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewGetDeepObjectRequest(c.Server, params) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) GetQueryDelimited(ctx context.Context, params *GetQueryDelimitedParams, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewGetQueryDelimitedRequest(c.Server, params) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) GetQueryForm(ctx context.Context, params *GetQueryFormParams, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewGetQueryFormRequest(c.Server, params) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) GetSimpleExplodeArray(ctx context.Context, param []int32, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewGetSimpleExplodeArrayRequest(c.Server, param) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) GetSimpleExplodeObject(ctx context.Context, param Object, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewGetSimpleExplodeObjectRequest(c.Server, param) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) GetSimpleExplodePrimitive(ctx context.Context, param int32, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewGetSimpleExplodePrimitiveRequest(c.Server, param) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) GetSimpleNoExplodeArray(ctx context.Context, param []int32, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewGetSimpleNoExplodeArrayRequest(c.Server, param) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) GetSimpleNoExplodeObject(ctx context.Context, param Object, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewGetSimpleNoExplodeObjectRequest(c.Server, param) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) GetSimplePrimitive(ctx context.Context, param int32, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewGetSimplePrimitiveRequest(c.Server, param) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) GetStartingWithNumber(ctx context.Context, n1param string, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewGetStartingWithNumberRequest(c.Server, n1param) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -// NewGetContentObjectRequest generates requests for GetContentObject -func NewGetContentObjectRequest(server string, param ComplexObject) (*http.Request, error) { - var err error - - var pathParam0 string - - var pathParamBuf0 []byte - pathParamBuf0, err = json.Marshal(param) - if err != nil { - return nil, err - } - pathParam0 = string(pathParamBuf0) - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/contentObject/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest(http.MethodGet, queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewGetCookieRequest generates requests for GetCookie -func NewGetCookieRequest(server string, params *GetCookieParams) (*http.Request, error) { - var err error - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/cookie") - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest(http.MethodGet, queryURL.String(), nil) - if err != nil { - return nil, err - } - - if params != nil { - - if params.P != nil { - var cookieParam0 string - - cookieParam0, err = runtime.StyleParamWithOptions("simple", false, "p", *params.P, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationCookie, Type: "integer", Format: "int32"}) - if err != nil { - return nil, err - } - - cookie0 := &http.Cookie{ - Name: "p", - Value: cookieParam0, - } - req.AddCookie(cookie0) - } - - if params.Ep != nil { - var cookieParam1 string - - cookieParam1, err = runtime.StyleParamWithOptions("simple", true, "ep", *params.Ep, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationCookie, Type: "integer", Format: "int32"}) - if err != nil { - return nil, err - } - - cookie1 := &http.Cookie{ - Name: "ep", - Value: cookieParam1, - } - req.AddCookie(cookie1) - } - - if params.Ea != nil { - var cookieParam2 string - - cookieParam2, err = runtime.StyleParamWithOptions("simple", true, "ea", *params.Ea, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationCookie, Type: "array", Format: ""}) - if err != nil { - return nil, err - } - - cookie2 := &http.Cookie{ - Name: "ea", - Value: cookieParam2, - } - req.AddCookie(cookie2) - } - - if params.A != nil { - var cookieParam3 string - - cookieParam3, err = runtime.StyleParamWithOptions("simple", false, "a", *params.A, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationCookie, Type: "array", Format: ""}) - if err != nil { - return nil, err - } - - cookie3 := &http.Cookie{ - Name: "a", - Value: cookieParam3, - } - req.AddCookie(cookie3) - } - - if params.Eo != nil { - var cookieParam4 string - - cookieParam4, err = runtime.StyleParamWithOptions("simple", true, "eo", *params.Eo, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationCookie, Type: "", Format: ""}) - if err != nil { - return nil, err - } - - cookie4 := &http.Cookie{ - Name: "eo", - Value: cookieParam4, - } - req.AddCookie(cookie4) - } - - if params.O != nil { - var cookieParam5 string - - cookieParam5, err = runtime.StyleParamWithOptions("simple", false, "o", *params.O, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationCookie, Type: "", Format: ""}) - if err != nil { - return nil, err - } - - cookie5 := &http.Cookie{ - Name: "o", - Value: cookieParam5, - } - req.AddCookie(cookie5) - } - - if params.Co != nil { - var cookieParam6 string - - var cookieParamBuf6 []byte - cookieParamBuf6, err = json.Marshal(*params.Co) - if err != nil { - return nil, err - } - cookieParam6 = url.QueryEscape(string(cookieParamBuf6)) - - cookie6 := &http.Cookie{ - Name: "co", - Value: cookieParam6, - } - req.AddCookie(cookie6) - } - - if params.N1s != nil { - var cookieParam7 string - - cookieParam7, err = runtime.StyleParamWithOptions("simple", true, "1s", *params.N1s, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationCookie, Type: "string", Format: ""}) - if err != nil { - return nil, err - } - - cookie7 := &http.Cookie{ - Name: "1s", - Value: cookieParam7, - } - req.AddCookie(cookie7) - } - } - return req, nil -} - -// NewEnumParamsRequest generates requests for EnumParams -func NewEnumParamsRequest(server string, params *EnumParamsParams) (*http.Request, error) { - var err error - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/enums") - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - if params != nil { - // queryValues collects non-styled parameters (passthrough, JSON) - // that are safe to round-trip through url.Values.Encode(). - queryValues := queryURL.Query() - // rawQueryFragments collects pre-encoded query fragments from - // styled parameters, preserving literal commas as delimiters - // per the OpenAPI spec (e.g. "color=blue,black,brown"). - var rawQueryFragments []string - - if params.EnumPathParam != nil { - - if queryFrag, err := runtime.StyleParamWithOptions("form", true, "enumPathParam", *params.EnumPathParam, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationQuery, Type: "integer", Format: "int32"}); err != nil { - return nil, err - } else { - for _, qp := range strings.Split(queryFrag, "&") { - rawQueryFragments = append(rawQueryFragments, qp) - } - } - - } - - if encoded := queryValues.Encode(); encoded != "" { - rawQueryFragments = append(rawQueryFragments, encoded) - } - queryURL.RawQuery = strings.Join(rawQueryFragments, "&") - } - - req, err := http.NewRequest(http.MethodGet, queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewGetHeaderRequest generates requests for GetHeader -func NewGetHeaderRequest(server string, params *GetHeaderParams) (*http.Request, error) { - var err error - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/header") - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest(http.MethodGet, queryURL.String(), nil) - if err != nil { - return nil, err - } - - if params != nil { - - if params.XPrimitive != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithOptions("simple", false, "X-Primitive", *params.XPrimitive, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationHeader, Type: "integer", Format: "int32"}) - if err != nil { - return nil, err - } - - req.Header.Set("X-Primitive", headerParam0) - } - - if params.XPrimitiveExploded != nil { - var headerParam1 string - - headerParam1, err = runtime.StyleParamWithOptions("simple", true, "X-Primitive-Exploded", *params.XPrimitiveExploded, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationHeader, Type: "integer", Format: "int32"}) - if err != nil { - return nil, err - } - - req.Header.Set("X-Primitive-Exploded", headerParam1) - } - - if params.XArrayExploded != nil { - var headerParam2 string - - headerParam2, err = runtime.StyleParamWithOptions("simple", true, "X-Array-Exploded", *params.XArrayExploded, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationHeader, Type: "array", Format: ""}) - if err != nil { - return nil, err - } - - req.Header.Set("X-Array-Exploded", headerParam2) - } - - if params.XArray != nil { - var headerParam3 string - - headerParam3, err = runtime.StyleParamWithOptions("simple", false, "X-Array", *params.XArray, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationHeader, Type: "array", Format: ""}) - if err != nil { - return nil, err - } - - req.Header.Set("X-Array", headerParam3) - } - - if params.XObjectExploded != nil { - var headerParam4 string - - headerParam4, err = runtime.StyleParamWithOptions("simple", true, "X-Object-Exploded", *params.XObjectExploded, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationHeader, Type: "", Format: ""}) - if err != nil { - return nil, err - } - - req.Header.Set("X-Object-Exploded", headerParam4) - } - - if params.XObject != nil { - var headerParam5 string - - headerParam5, err = runtime.StyleParamWithOptions("simple", false, "X-Object", *params.XObject, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationHeader, Type: "", Format: ""}) - if err != nil { - return nil, err - } - - req.Header.Set("X-Object", headerParam5) - } - - if params.XComplexObject != nil { - var headerParam6 string - - var headerParamBuf6 []byte - headerParamBuf6, err = json.Marshal(*params.XComplexObject) - if err != nil { - return nil, err - } - headerParam6 = string(headerParamBuf6) - - req.Header.Set("X-Complex-Object", headerParam6) - } - - if params.N1StartingWithNumber != nil { - var headerParam7 string - - headerParam7, err = runtime.StyleParamWithOptions("simple", false, "1-Starting-With-Number", *params.N1StartingWithNumber, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationHeader, Type: "string", Format: ""}) - if err != nil { - return nil, err - } - - req.Header.Set("1-Starting-With-Number", headerParam7) - } - - } - - return req, nil -} - -// NewGetLabelExplodeArrayRequest generates requests for GetLabelExplodeArray -func NewGetLabelExplodeArrayRequest(server string, param []int32) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithOptions("label", true, "param", param, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationPath, Type: "array", Format: ""}) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/labelExplodeArray/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest(http.MethodGet, queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewGetLabelExplodeObjectRequest generates requests for GetLabelExplodeObject -func NewGetLabelExplodeObjectRequest(server string, param Object) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithOptions("label", true, "param", param, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationPath, Type: "", Format: ""}) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/labelExplodeObject/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest(http.MethodGet, queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewGetLabelExplodePrimitiveRequest generates requests for GetLabelExplodePrimitive -func NewGetLabelExplodePrimitiveRequest(server string, param int32) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithOptions("label", true, "param", param, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationPath, Type: "integer", Format: "int32"}) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/labelExplodePrimitive/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest(http.MethodGet, queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewGetLabelNoExplodeArrayRequest generates requests for GetLabelNoExplodeArray -func NewGetLabelNoExplodeArrayRequest(server string, param []int32) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithOptions("label", false, "param", param, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationPath, Type: "array", Format: ""}) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/labelNoExplodeArray/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest(http.MethodGet, queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewGetLabelNoExplodeObjectRequest generates requests for GetLabelNoExplodeObject -func NewGetLabelNoExplodeObjectRequest(server string, param Object) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithOptions("label", false, "param", param, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationPath, Type: "", Format: ""}) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/labelNoExplodeObject/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest(http.MethodGet, queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewGetLabelPrimitiveRequest generates requests for GetLabelPrimitive -func NewGetLabelPrimitiveRequest(server string, param int32) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithOptions("label", false, "param", param, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationPath, Type: "integer", Format: "int32"}) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/labelPrimitive/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest(http.MethodGet, queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewGetMatrixExplodeArrayRequest generates requests for GetMatrixExplodeArray -func NewGetMatrixExplodeArrayRequest(server string, id []int32) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithOptions("matrix", true, "id", id, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationPath, Type: "array", Format: ""}) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/matrixExplodeArray/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest(http.MethodGet, queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewGetMatrixExplodeObjectRequest generates requests for GetMatrixExplodeObject -func NewGetMatrixExplodeObjectRequest(server string, id Object) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithOptions("matrix", true, "id", id, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationPath, Type: "", Format: ""}) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/matrixExplodeObject/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest(http.MethodGet, queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewGetMatrixExplodePrimitiveRequest generates requests for GetMatrixExplodePrimitive -func NewGetMatrixExplodePrimitiveRequest(server string, id int32) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithOptions("matrix", true, "id", id, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationPath, Type: "integer", Format: "int32"}) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/matrixExplodePrimitive/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest(http.MethodGet, queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewGetMatrixNoExplodeArrayRequest generates requests for GetMatrixNoExplodeArray -func NewGetMatrixNoExplodeArrayRequest(server string, id []int32) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithOptions("matrix", false, "id", id, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationPath, Type: "array", Format: ""}) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/matrixNoExplodeArray/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest(http.MethodGet, queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewGetMatrixNoExplodeObjectRequest generates requests for GetMatrixNoExplodeObject -func NewGetMatrixNoExplodeObjectRequest(server string, id Object) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithOptions("matrix", false, "id", id, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationPath, Type: "", Format: ""}) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/matrixNoExplodeObject/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest(http.MethodGet, queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewGetMatrixPrimitiveRequest generates requests for GetMatrixPrimitive -func NewGetMatrixPrimitiveRequest(server string, id int32) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithOptions("matrix", false, "id", id, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationPath, Type: "integer", Format: "int32"}) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/matrixPrimitive/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest(http.MethodGet, queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewGetPassThroughRequest generates requests for GetPassThrough -func NewGetPassThroughRequest(server string, param string) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0 = param - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/passThrough/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest(http.MethodGet, queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewGetDeepObjectRequest generates requests for GetDeepObject -func NewGetDeepObjectRequest(server string, params *GetDeepObjectParams) (*http.Request, error) { - var err error - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/queryDeepObject") - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - if params != nil { - // queryValues collects non-styled parameters (passthrough, JSON) - // that are safe to round-trip through url.Values.Encode(). - queryValues := queryURL.Query() - // rawQueryFragments collects pre-encoded query fragments from - // styled parameters, preserving literal commas as delimiters - // per the OpenAPI spec (e.g. "color=blue,black,brown"). - var rawQueryFragments []string - - if queryFrag, err := runtime.StyleParamWithOptions("deepObject", true, "deepObj", params.DeepObj, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationQuery, Type: "", Format: ""}); err != nil { - return nil, err - } else { - for _, qp := range strings.Split(queryFrag, "&") { - rawQueryFragments = append(rawQueryFragments, qp) - } - } - - if encoded := queryValues.Encode(); encoded != "" { - rawQueryFragments = append(rawQueryFragments, encoded) - } - queryURL.RawQuery = strings.Join(rawQueryFragments, "&") - } - - req, err := http.NewRequest(http.MethodGet, queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewGetQueryDelimitedRequest generates requests for GetQueryDelimited -func NewGetQueryDelimitedRequest(server string, params *GetQueryDelimitedParams) (*http.Request, error) { - var err error - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/queryDelimited") - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - if params != nil { - // queryValues collects non-styled parameters (passthrough, JSON) - // that are safe to round-trip through url.Values.Encode(). - queryValues := queryURL.Query() - // rawQueryFragments collects pre-encoded query fragments from - // styled parameters, preserving literal commas as delimiters - // per the OpenAPI spec (e.g. "color=blue,black,brown"). - var rawQueryFragments []string - - if params.Sa != nil { - - if queryFrag, err := runtime.StyleParamWithOptions("spaceDelimited", false, "sa", *params.Sa, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationQuery, Type: "array", Format: ""}); err != nil { - return nil, err - } else { - for _, qp := range strings.Split(queryFrag, "&") { - rawQueryFragments = append(rawQueryFragments, qp) - } - } - - } - - if params.Pa != nil { - - if queryFrag, err := runtime.StyleParamWithOptions("pipeDelimited", false, "pa", *params.Pa, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationQuery, Type: "array", Format: ""}); err != nil { - return nil, err - } else { - for _, qp := range strings.Split(queryFrag, "&") { - rawQueryFragments = append(rawQueryFragments, qp) - } - } - - } - - if encoded := queryValues.Encode(); encoded != "" { - rawQueryFragments = append(rawQueryFragments, encoded) - } - queryURL.RawQuery = strings.Join(rawQueryFragments, "&") - } - - req, err := http.NewRequest(http.MethodGet, queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewGetQueryFormRequest generates requests for GetQueryForm -func NewGetQueryFormRequest(server string, params *GetQueryFormParams) (*http.Request, error) { - var err error - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/queryForm") - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - if params != nil { - // queryValues collects non-styled parameters (passthrough, JSON) - // that are safe to round-trip through url.Values.Encode(). - queryValues := queryURL.Query() - // rawQueryFragments collects pre-encoded query fragments from - // styled parameters, preserving literal commas as delimiters - // per the OpenAPI spec (e.g. "color=blue,black,brown"). - var rawQueryFragments []string - - if params.Ea != nil { - - if queryFrag, err := runtime.StyleParamWithOptions("form", true, "ea", *params.Ea, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationQuery, Type: "array", Format: ""}); err != nil { - return nil, err - } else { - for _, qp := range strings.Split(queryFrag, "&") { - rawQueryFragments = append(rawQueryFragments, qp) - } - } - - } - - if params.A != nil { - - if queryFrag, err := runtime.StyleParamWithOptions("form", false, "a", *params.A, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationQuery, Type: "array", Format: ""}); err != nil { - return nil, err - } else { - for _, qp := range strings.Split(queryFrag, "&") { - rawQueryFragments = append(rawQueryFragments, qp) - } - } - - } - - if params.Eo != nil { - - if queryFrag, err := runtime.StyleParamWithOptions("form", true, "eo", *params.Eo, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationQuery, Type: "", Format: ""}); err != nil { - return nil, err - } else { - for _, qp := range strings.Split(queryFrag, "&") { - rawQueryFragments = append(rawQueryFragments, qp) - } - } - - } - - if params.O != nil { - - if queryFrag, err := runtime.StyleParamWithOptions("form", false, "o", *params.O, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationQuery, Type: "", Format: ""}); err != nil { - return nil, err - } else { - for _, qp := range strings.Split(queryFrag, "&") { - rawQueryFragments = append(rawQueryFragments, qp) - } - } - - } - - if params.Ep != nil { - - if queryFrag, err := runtime.StyleParamWithOptions("form", true, "ep", *params.Ep, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationQuery, Type: "integer", Format: "int32"}); err != nil { - return nil, err - } else { - for _, qp := range strings.Split(queryFrag, "&") { - rawQueryFragments = append(rawQueryFragments, qp) - } - } - - } - - if params.P != nil { - - if queryFrag, err := runtime.StyleParamWithOptions("form", false, "p", *params.P, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationQuery, Type: "integer", Format: "int32"}); err != nil { - return nil, err - } else { - for _, qp := range strings.Split(queryFrag, "&") { - rawQueryFragments = append(rawQueryFragments, qp) - } - } - - } - - if params.Ps != nil { - - if queryFrag, err := runtime.StyleParamWithOptions("form", true, "ps", *params.Ps, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationQuery, Type: "string", Format: ""}); err != nil { - return nil, err - } else { - for _, qp := range strings.Split(queryFrag, "&") { - rawQueryFragments = append(rawQueryFragments, qp) - } - } - - } - - if params.Co != nil { - - if queryParamBuf, err := json.Marshal(*params.Co); err != nil { - return nil, err - } else { - queryValues.Add("co", string(queryParamBuf)) - } - - } - - if params.N1s != nil { - - if queryFrag, err := runtime.StyleParamWithOptions("form", true, "1s", *params.N1s, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationQuery, Type: "string", Format: ""}); err != nil { - return nil, err - } else { - for _, qp := range strings.Split(queryFrag, "&") { - rawQueryFragments = append(rawQueryFragments, qp) - } - } - - } - - if encoded := queryValues.Encode(); encoded != "" { - rawQueryFragments = append(rawQueryFragments, encoded) - } - queryURL.RawQuery = strings.Join(rawQueryFragments, "&") - } - - req, err := http.NewRequest(http.MethodGet, queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewGetSimpleExplodeArrayRequest generates requests for GetSimpleExplodeArray -func NewGetSimpleExplodeArrayRequest(server string, param []int32) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithOptions("simple", true, "param", param, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationPath, Type: "array", Format: ""}) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/simpleExplodeArray/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest(http.MethodGet, queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewGetSimpleExplodeObjectRequest generates requests for GetSimpleExplodeObject -func NewGetSimpleExplodeObjectRequest(server string, param Object) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithOptions("simple", true, "param", param, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationPath, Type: "", Format: ""}) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/simpleExplodeObject/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest(http.MethodGet, queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewGetSimpleExplodePrimitiveRequest generates requests for GetSimpleExplodePrimitive -func NewGetSimpleExplodePrimitiveRequest(server string, param int32) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithOptions("simple", true, "param", param, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationPath, Type: "integer", Format: "int32"}) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/simpleExplodePrimitive/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest(http.MethodGet, queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewGetSimpleNoExplodeArrayRequest generates requests for GetSimpleNoExplodeArray -func NewGetSimpleNoExplodeArrayRequest(server string, param []int32) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithOptions("simple", false, "param", param, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationPath, Type: "array", Format: ""}) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/simpleNoExplodeArray/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest(http.MethodGet, queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewGetSimpleNoExplodeObjectRequest generates requests for GetSimpleNoExplodeObject -func NewGetSimpleNoExplodeObjectRequest(server string, param Object) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithOptions("simple", false, "param", param, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationPath, Type: "", Format: ""}) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/simpleNoExplodeObject/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest(http.MethodGet, queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewGetSimplePrimitiveRequest generates requests for GetSimplePrimitive -func NewGetSimplePrimitiveRequest(server string, param int32) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithOptions("simple", false, "param", param, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationPath, Type: "integer", Format: "int32"}) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/simplePrimitive/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest(http.MethodGet, queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewGetStartingWithNumberRequest generates requests for GetStartingWithNumber -func NewGetStartingWithNumberRequest(server string, n1param string) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0 = n1param - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/startingWithNumber/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest(http.MethodGet, queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -func (c *Client) applyEditors(ctx context.Context, req *http.Request, additionalEditors []RequestEditorFn) error { - for _, r := range c.RequestEditors { - if err := r(ctx, req); err != nil { - return err - } - } - for _, r := range additionalEditors { - if err := r(ctx, req); err != nil { - return err - } - } - return nil -} - -// ClientWithResponses builds on ClientInterface to offer response payloads -type ClientWithResponses struct { - ClientInterface -} - -// NewClientWithResponses creates a new ClientWithResponses, which wraps -// Client with return type handling -func NewClientWithResponses(server string, opts ...ClientOption) (*ClientWithResponses, error) { - client, err := NewClient(server, opts...) - if err != nil { - return nil, err - } - return &ClientWithResponses{client}, nil -} - -// WithBaseURL overrides the baseURL. -func WithBaseURL(baseURL string) ClientOption { - return func(c *Client) error { - newBaseURL, err := url.Parse(baseURL) - if err != nil { - return err - } - c.Server = newBaseURL.String() - return nil - } -} - -// ClientWithResponsesInterface is the interface specification for the client with responses above. -type ClientWithResponsesInterface interface { - // GetContentObjectWithResponse request - GetContentObjectWithResponse(ctx context.Context, param ComplexObject, reqEditors ...RequestEditorFn) (*GetContentObjectResponse, error) - - // GetCookieWithResponse request - GetCookieWithResponse(ctx context.Context, params *GetCookieParams, reqEditors ...RequestEditorFn) (*GetCookieResponse, error) - - // EnumParamsWithResponse request - EnumParamsWithResponse(ctx context.Context, params *EnumParamsParams, reqEditors ...RequestEditorFn) (*EnumParamsResponse, error) - - // GetHeaderWithResponse request - GetHeaderWithResponse(ctx context.Context, params *GetHeaderParams, reqEditors ...RequestEditorFn) (*GetHeaderResponse, error) - - // GetLabelExplodeArrayWithResponse request - GetLabelExplodeArrayWithResponse(ctx context.Context, param []int32, reqEditors ...RequestEditorFn) (*GetLabelExplodeArrayResponse, error) - - // GetLabelExplodeObjectWithResponse request - GetLabelExplodeObjectWithResponse(ctx context.Context, param Object, reqEditors ...RequestEditorFn) (*GetLabelExplodeObjectResponse, error) - - // GetLabelExplodePrimitiveWithResponse request - GetLabelExplodePrimitiveWithResponse(ctx context.Context, param int32, reqEditors ...RequestEditorFn) (*GetLabelExplodePrimitiveResponse, error) - - // GetLabelNoExplodeArrayWithResponse request - GetLabelNoExplodeArrayWithResponse(ctx context.Context, param []int32, reqEditors ...RequestEditorFn) (*GetLabelNoExplodeArrayResponse, error) - - // GetLabelNoExplodeObjectWithResponse request - GetLabelNoExplodeObjectWithResponse(ctx context.Context, param Object, reqEditors ...RequestEditorFn) (*GetLabelNoExplodeObjectResponse, error) - - // GetLabelPrimitiveWithResponse request - GetLabelPrimitiveWithResponse(ctx context.Context, param int32, reqEditors ...RequestEditorFn) (*GetLabelPrimitiveResponse, error) - - // GetMatrixExplodeArrayWithResponse request - GetMatrixExplodeArrayWithResponse(ctx context.Context, id []int32, reqEditors ...RequestEditorFn) (*GetMatrixExplodeArrayResponse, error) - - // GetMatrixExplodeObjectWithResponse request - GetMatrixExplodeObjectWithResponse(ctx context.Context, id Object, reqEditors ...RequestEditorFn) (*GetMatrixExplodeObjectResponse, error) - - // GetMatrixExplodePrimitiveWithResponse request - GetMatrixExplodePrimitiveWithResponse(ctx context.Context, id int32, reqEditors ...RequestEditorFn) (*GetMatrixExplodePrimitiveResponse, error) - - // GetMatrixNoExplodeArrayWithResponse request - GetMatrixNoExplodeArrayWithResponse(ctx context.Context, id []int32, reqEditors ...RequestEditorFn) (*GetMatrixNoExplodeArrayResponse, error) - - // GetMatrixNoExplodeObjectWithResponse request - GetMatrixNoExplodeObjectWithResponse(ctx context.Context, id Object, reqEditors ...RequestEditorFn) (*GetMatrixNoExplodeObjectResponse, error) - - // GetMatrixPrimitiveWithResponse request - GetMatrixPrimitiveWithResponse(ctx context.Context, id int32, reqEditors ...RequestEditorFn) (*GetMatrixPrimitiveResponse, error) - - // GetPassThroughWithResponse request - GetPassThroughWithResponse(ctx context.Context, param string, reqEditors ...RequestEditorFn) (*GetPassThroughResponse, error) - - // GetDeepObjectWithResponse request - GetDeepObjectWithResponse(ctx context.Context, params *GetDeepObjectParams, reqEditors ...RequestEditorFn) (*GetDeepObjectResponse, error) - - // GetQueryDelimitedWithResponse request - GetQueryDelimitedWithResponse(ctx context.Context, params *GetQueryDelimitedParams, reqEditors ...RequestEditorFn) (*GetQueryDelimitedResponse, error) - - // GetQueryFormWithResponse request - GetQueryFormWithResponse(ctx context.Context, params *GetQueryFormParams, reqEditors ...RequestEditorFn) (*GetQueryFormResponse, error) - - // GetSimpleExplodeArrayWithResponse request - GetSimpleExplodeArrayWithResponse(ctx context.Context, param []int32, reqEditors ...RequestEditorFn) (*GetSimpleExplodeArrayResponse, error) - - // GetSimpleExplodeObjectWithResponse request - GetSimpleExplodeObjectWithResponse(ctx context.Context, param Object, reqEditors ...RequestEditorFn) (*GetSimpleExplodeObjectResponse, error) - - // GetSimpleExplodePrimitiveWithResponse request - GetSimpleExplodePrimitiveWithResponse(ctx context.Context, param int32, reqEditors ...RequestEditorFn) (*GetSimpleExplodePrimitiveResponse, error) - - // GetSimpleNoExplodeArrayWithResponse request - GetSimpleNoExplodeArrayWithResponse(ctx context.Context, param []int32, reqEditors ...RequestEditorFn) (*GetSimpleNoExplodeArrayResponse, error) - - // GetSimpleNoExplodeObjectWithResponse request - GetSimpleNoExplodeObjectWithResponse(ctx context.Context, param Object, reqEditors ...RequestEditorFn) (*GetSimpleNoExplodeObjectResponse, error) - - // GetSimplePrimitiveWithResponse request - GetSimplePrimitiveWithResponse(ctx context.Context, param int32, reqEditors ...RequestEditorFn) (*GetSimplePrimitiveResponse, error) - - // GetStartingWithNumberWithResponse request - GetStartingWithNumberWithResponse(ctx context.Context, n1param string, reqEditors ...RequestEditorFn) (*GetStartingWithNumberResponse, error) -} - -type GetContentObjectResponse struct { - Body []byte - HTTPResponse *http.Response -} - -// Status returns HTTPResponse.Status -func (r GetContentObjectResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r GetContentObjectResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -// ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers -func (r GetContentObjectResponse) ContentType() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Header.Get("Content-Type") - } - return "" -} - -type GetCookieResponse struct { - Body []byte - HTTPResponse *http.Response -} - -// Status returns HTTPResponse.Status -func (r GetCookieResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r GetCookieResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -// ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers -func (r GetCookieResponse) ContentType() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Header.Get("Content-Type") - } - return "" -} - -type EnumParamsResponse struct { - Body []byte - HTTPResponse *http.Response -} - -// Status returns HTTPResponse.Status -func (r EnumParamsResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r EnumParamsResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -// ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers -func (r EnumParamsResponse) ContentType() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Header.Get("Content-Type") - } - return "" -} - -type GetHeaderResponse struct { - Body []byte - HTTPResponse *http.Response -} - -// Status returns HTTPResponse.Status -func (r GetHeaderResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r GetHeaderResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -// ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers -func (r GetHeaderResponse) ContentType() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Header.Get("Content-Type") - } - return "" -} - -type GetLabelExplodeArrayResponse struct { - Body []byte - HTTPResponse *http.Response -} - -// Status returns HTTPResponse.Status -func (r GetLabelExplodeArrayResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r GetLabelExplodeArrayResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -// ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers -func (r GetLabelExplodeArrayResponse) ContentType() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Header.Get("Content-Type") - } - return "" -} - -type GetLabelExplodeObjectResponse struct { - Body []byte - HTTPResponse *http.Response -} - -// Status returns HTTPResponse.Status -func (r GetLabelExplodeObjectResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r GetLabelExplodeObjectResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -// ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers -func (r GetLabelExplodeObjectResponse) ContentType() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Header.Get("Content-Type") - } - return "" -} - -type GetLabelExplodePrimitiveResponse struct { - Body []byte - HTTPResponse *http.Response -} - -// Status returns HTTPResponse.Status -func (r GetLabelExplodePrimitiveResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r GetLabelExplodePrimitiveResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -// ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers -func (r GetLabelExplodePrimitiveResponse) ContentType() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Header.Get("Content-Type") - } - return "" -} - -type GetLabelNoExplodeArrayResponse struct { - Body []byte - HTTPResponse *http.Response -} - -// Status returns HTTPResponse.Status -func (r GetLabelNoExplodeArrayResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r GetLabelNoExplodeArrayResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -// ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers -func (r GetLabelNoExplodeArrayResponse) ContentType() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Header.Get("Content-Type") - } - return "" -} - -type GetLabelNoExplodeObjectResponse struct { - Body []byte - HTTPResponse *http.Response -} - -// Status returns HTTPResponse.Status -func (r GetLabelNoExplodeObjectResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r GetLabelNoExplodeObjectResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -// ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers -func (r GetLabelNoExplodeObjectResponse) ContentType() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Header.Get("Content-Type") - } - return "" -} - -type GetLabelPrimitiveResponse struct { - Body []byte - HTTPResponse *http.Response -} - -// Status returns HTTPResponse.Status -func (r GetLabelPrimitiveResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r GetLabelPrimitiveResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -// ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers -func (r GetLabelPrimitiveResponse) ContentType() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Header.Get("Content-Type") - } - return "" -} - -type GetMatrixExplodeArrayResponse struct { - Body []byte - HTTPResponse *http.Response -} - -// Status returns HTTPResponse.Status -func (r GetMatrixExplodeArrayResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r GetMatrixExplodeArrayResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -// ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers -func (r GetMatrixExplodeArrayResponse) ContentType() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Header.Get("Content-Type") - } - return "" -} - -type GetMatrixExplodeObjectResponse struct { - Body []byte - HTTPResponse *http.Response -} - -// Status returns HTTPResponse.Status -func (r GetMatrixExplodeObjectResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r GetMatrixExplodeObjectResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -// ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers -func (r GetMatrixExplodeObjectResponse) ContentType() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Header.Get("Content-Type") - } - return "" -} - -type GetMatrixExplodePrimitiveResponse struct { - Body []byte - HTTPResponse *http.Response -} - -// Status returns HTTPResponse.Status -func (r GetMatrixExplodePrimitiveResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r GetMatrixExplodePrimitiveResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -// ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers -func (r GetMatrixExplodePrimitiveResponse) ContentType() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Header.Get("Content-Type") - } - return "" -} - -type GetMatrixNoExplodeArrayResponse struct { - Body []byte - HTTPResponse *http.Response -} - -// Status returns HTTPResponse.Status -func (r GetMatrixNoExplodeArrayResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r GetMatrixNoExplodeArrayResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -// ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers -func (r GetMatrixNoExplodeArrayResponse) ContentType() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Header.Get("Content-Type") - } - return "" -} - -type GetMatrixNoExplodeObjectResponse struct { - Body []byte - HTTPResponse *http.Response -} - -// Status returns HTTPResponse.Status -func (r GetMatrixNoExplodeObjectResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r GetMatrixNoExplodeObjectResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -// ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers -func (r GetMatrixNoExplodeObjectResponse) ContentType() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Header.Get("Content-Type") - } - return "" -} - -type GetMatrixPrimitiveResponse struct { - Body []byte - HTTPResponse *http.Response -} - -// Status returns HTTPResponse.Status -func (r GetMatrixPrimitiveResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r GetMatrixPrimitiveResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -// ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers -func (r GetMatrixPrimitiveResponse) ContentType() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Header.Get("Content-Type") - } - return "" -} - -type GetPassThroughResponse struct { - Body []byte - HTTPResponse *http.Response -} - -// Status returns HTTPResponse.Status -func (r GetPassThroughResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r GetPassThroughResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -// ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers -func (r GetPassThroughResponse) ContentType() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Header.Get("Content-Type") - } - return "" -} - -type GetDeepObjectResponse struct { - Body []byte - HTTPResponse *http.Response -} - -// Status returns HTTPResponse.Status -func (r GetDeepObjectResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r GetDeepObjectResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -// ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers -func (r GetDeepObjectResponse) ContentType() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Header.Get("Content-Type") - } - return "" -} - -type GetQueryDelimitedResponse struct { - Body []byte - HTTPResponse *http.Response -} - -// Status returns HTTPResponse.Status -func (r GetQueryDelimitedResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r GetQueryDelimitedResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -// ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers -func (r GetQueryDelimitedResponse) ContentType() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Header.Get("Content-Type") - } - return "" -} - -type GetQueryFormResponse struct { - Body []byte - HTTPResponse *http.Response -} - -// Status returns HTTPResponse.Status -func (r GetQueryFormResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r GetQueryFormResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -// ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers -func (r GetQueryFormResponse) ContentType() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Header.Get("Content-Type") - } - return "" -} - -type GetSimpleExplodeArrayResponse struct { - Body []byte - HTTPResponse *http.Response -} - -// Status returns HTTPResponse.Status -func (r GetSimpleExplodeArrayResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r GetSimpleExplodeArrayResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -// ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers -func (r GetSimpleExplodeArrayResponse) ContentType() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Header.Get("Content-Type") - } - return "" -} - -type GetSimpleExplodeObjectResponse struct { - Body []byte - HTTPResponse *http.Response -} - -// Status returns HTTPResponse.Status -func (r GetSimpleExplodeObjectResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r GetSimpleExplodeObjectResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -// ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers -func (r GetSimpleExplodeObjectResponse) ContentType() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Header.Get("Content-Type") - } - return "" -} - -type GetSimpleExplodePrimitiveResponse struct { - Body []byte - HTTPResponse *http.Response -} - -// Status returns HTTPResponse.Status -func (r GetSimpleExplodePrimitiveResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r GetSimpleExplodePrimitiveResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -// ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers -func (r GetSimpleExplodePrimitiveResponse) ContentType() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Header.Get("Content-Type") - } - return "" -} - -type GetSimpleNoExplodeArrayResponse struct { - Body []byte - HTTPResponse *http.Response -} - -// Status returns HTTPResponse.Status -func (r GetSimpleNoExplodeArrayResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r GetSimpleNoExplodeArrayResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -// ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers -func (r GetSimpleNoExplodeArrayResponse) ContentType() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Header.Get("Content-Type") - } - return "" -} - -type GetSimpleNoExplodeObjectResponse struct { - Body []byte - HTTPResponse *http.Response -} - -// Status returns HTTPResponse.Status -func (r GetSimpleNoExplodeObjectResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r GetSimpleNoExplodeObjectResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -// ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers -func (r GetSimpleNoExplodeObjectResponse) ContentType() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Header.Get("Content-Type") - } - return "" -} - -type GetSimplePrimitiveResponse struct { - Body []byte - HTTPResponse *http.Response -} - -// Status returns HTTPResponse.Status -func (r GetSimplePrimitiveResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r GetSimplePrimitiveResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -// ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers -func (r GetSimplePrimitiveResponse) ContentType() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Header.Get("Content-Type") - } - return "" -} - -type GetStartingWithNumberResponse struct { - Body []byte - HTTPResponse *http.Response -} - -// Status returns HTTPResponse.Status -func (r GetStartingWithNumberResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r GetStartingWithNumberResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -// ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers -func (r GetStartingWithNumberResponse) ContentType() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Header.Get("Content-Type") - } - return "" -} - -// GetContentObjectWithResponse request returning *GetContentObjectResponse -func (c *ClientWithResponses) GetContentObjectWithResponse(ctx context.Context, param ComplexObject, reqEditors ...RequestEditorFn) (*GetContentObjectResponse, error) { - rsp, err := c.GetContentObject(ctx, param, reqEditors...) - if err != nil { - return nil, err - } - return ParseGetContentObjectResponse(rsp) -} - -// GetCookieWithResponse request returning *GetCookieResponse -func (c *ClientWithResponses) GetCookieWithResponse(ctx context.Context, params *GetCookieParams, reqEditors ...RequestEditorFn) (*GetCookieResponse, error) { - rsp, err := c.GetCookie(ctx, params, reqEditors...) - if err != nil { - return nil, err - } - return ParseGetCookieResponse(rsp) -} - -// EnumParamsWithResponse request returning *EnumParamsResponse -func (c *ClientWithResponses) EnumParamsWithResponse(ctx context.Context, params *EnumParamsParams, reqEditors ...RequestEditorFn) (*EnumParamsResponse, error) { - rsp, err := c.EnumParams(ctx, params, reqEditors...) - if err != nil { - return nil, err - } - return ParseEnumParamsResponse(rsp) -} - -// GetHeaderWithResponse request returning *GetHeaderResponse -func (c *ClientWithResponses) GetHeaderWithResponse(ctx context.Context, params *GetHeaderParams, reqEditors ...RequestEditorFn) (*GetHeaderResponse, error) { - rsp, err := c.GetHeader(ctx, params, reqEditors...) - if err != nil { - return nil, err - } - return ParseGetHeaderResponse(rsp) -} - -// GetLabelExplodeArrayWithResponse request returning *GetLabelExplodeArrayResponse -func (c *ClientWithResponses) GetLabelExplodeArrayWithResponse(ctx context.Context, param []int32, reqEditors ...RequestEditorFn) (*GetLabelExplodeArrayResponse, error) { - rsp, err := c.GetLabelExplodeArray(ctx, param, reqEditors...) - if err != nil { - return nil, err - } - return ParseGetLabelExplodeArrayResponse(rsp) -} - -// GetLabelExplodeObjectWithResponse request returning *GetLabelExplodeObjectResponse -func (c *ClientWithResponses) GetLabelExplodeObjectWithResponse(ctx context.Context, param Object, reqEditors ...RequestEditorFn) (*GetLabelExplodeObjectResponse, error) { - rsp, err := c.GetLabelExplodeObject(ctx, param, reqEditors...) - if err != nil { - return nil, err - } - return ParseGetLabelExplodeObjectResponse(rsp) -} - -// GetLabelExplodePrimitiveWithResponse request returning *GetLabelExplodePrimitiveResponse -func (c *ClientWithResponses) GetLabelExplodePrimitiveWithResponse(ctx context.Context, param int32, reqEditors ...RequestEditorFn) (*GetLabelExplodePrimitiveResponse, error) { - rsp, err := c.GetLabelExplodePrimitive(ctx, param, reqEditors...) - if err != nil { - return nil, err - } - return ParseGetLabelExplodePrimitiveResponse(rsp) -} - -// GetLabelNoExplodeArrayWithResponse request returning *GetLabelNoExplodeArrayResponse -func (c *ClientWithResponses) GetLabelNoExplodeArrayWithResponse(ctx context.Context, param []int32, reqEditors ...RequestEditorFn) (*GetLabelNoExplodeArrayResponse, error) { - rsp, err := c.GetLabelNoExplodeArray(ctx, param, reqEditors...) - if err != nil { - return nil, err - } - return ParseGetLabelNoExplodeArrayResponse(rsp) -} - -// GetLabelNoExplodeObjectWithResponse request returning *GetLabelNoExplodeObjectResponse -func (c *ClientWithResponses) GetLabelNoExplodeObjectWithResponse(ctx context.Context, param Object, reqEditors ...RequestEditorFn) (*GetLabelNoExplodeObjectResponse, error) { - rsp, err := c.GetLabelNoExplodeObject(ctx, param, reqEditors...) - if err != nil { - return nil, err - } - return ParseGetLabelNoExplodeObjectResponse(rsp) -} - -// GetLabelPrimitiveWithResponse request returning *GetLabelPrimitiveResponse -func (c *ClientWithResponses) GetLabelPrimitiveWithResponse(ctx context.Context, param int32, reqEditors ...RequestEditorFn) (*GetLabelPrimitiveResponse, error) { - rsp, err := c.GetLabelPrimitive(ctx, param, reqEditors...) - if err != nil { - return nil, err - } - return ParseGetLabelPrimitiveResponse(rsp) -} - -// GetMatrixExplodeArrayWithResponse request returning *GetMatrixExplodeArrayResponse -func (c *ClientWithResponses) GetMatrixExplodeArrayWithResponse(ctx context.Context, id []int32, reqEditors ...RequestEditorFn) (*GetMatrixExplodeArrayResponse, error) { - rsp, err := c.GetMatrixExplodeArray(ctx, id, reqEditors...) - if err != nil { - return nil, err - } - return ParseGetMatrixExplodeArrayResponse(rsp) -} - -// GetMatrixExplodeObjectWithResponse request returning *GetMatrixExplodeObjectResponse -func (c *ClientWithResponses) GetMatrixExplodeObjectWithResponse(ctx context.Context, id Object, reqEditors ...RequestEditorFn) (*GetMatrixExplodeObjectResponse, error) { - rsp, err := c.GetMatrixExplodeObject(ctx, id, reqEditors...) - if err != nil { - return nil, err - } - return ParseGetMatrixExplodeObjectResponse(rsp) -} - -// GetMatrixExplodePrimitiveWithResponse request returning *GetMatrixExplodePrimitiveResponse -func (c *ClientWithResponses) GetMatrixExplodePrimitiveWithResponse(ctx context.Context, id int32, reqEditors ...RequestEditorFn) (*GetMatrixExplodePrimitiveResponse, error) { - rsp, err := c.GetMatrixExplodePrimitive(ctx, id, reqEditors...) - if err != nil { - return nil, err - } - return ParseGetMatrixExplodePrimitiveResponse(rsp) -} - -// GetMatrixNoExplodeArrayWithResponse request returning *GetMatrixNoExplodeArrayResponse -func (c *ClientWithResponses) GetMatrixNoExplodeArrayWithResponse(ctx context.Context, id []int32, reqEditors ...RequestEditorFn) (*GetMatrixNoExplodeArrayResponse, error) { - rsp, err := c.GetMatrixNoExplodeArray(ctx, id, reqEditors...) - if err != nil { - return nil, err - } - return ParseGetMatrixNoExplodeArrayResponse(rsp) -} - -// GetMatrixNoExplodeObjectWithResponse request returning *GetMatrixNoExplodeObjectResponse -func (c *ClientWithResponses) GetMatrixNoExplodeObjectWithResponse(ctx context.Context, id Object, reqEditors ...RequestEditorFn) (*GetMatrixNoExplodeObjectResponse, error) { - rsp, err := c.GetMatrixNoExplodeObject(ctx, id, reqEditors...) - if err != nil { - return nil, err - } - return ParseGetMatrixNoExplodeObjectResponse(rsp) -} - -// GetMatrixPrimitiveWithResponse request returning *GetMatrixPrimitiveResponse -func (c *ClientWithResponses) GetMatrixPrimitiveWithResponse(ctx context.Context, id int32, reqEditors ...RequestEditorFn) (*GetMatrixPrimitiveResponse, error) { - rsp, err := c.GetMatrixPrimitive(ctx, id, reqEditors...) - if err != nil { - return nil, err - } - return ParseGetMatrixPrimitiveResponse(rsp) -} - -// GetPassThroughWithResponse request returning *GetPassThroughResponse -func (c *ClientWithResponses) GetPassThroughWithResponse(ctx context.Context, param string, reqEditors ...RequestEditorFn) (*GetPassThroughResponse, error) { - rsp, err := c.GetPassThrough(ctx, param, reqEditors...) - if err != nil { - return nil, err - } - return ParseGetPassThroughResponse(rsp) -} - -// GetDeepObjectWithResponse request returning *GetDeepObjectResponse -func (c *ClientWithResponses) GetDeepObjectWithResponse(ctx context.Context, params *GetDeepObjectParams, reqEditors ...RequestEditorFn) (*GetDeepObjectResponse, error) { - rsp, err := c.GetDeepObject(ctx, params, reqEditors...) - if err != nil { - return nil, err - } - return ParseGetDeepObjectResponse(rsp) -} - -// GetQueryDelimitedWithResponse request returning *GetQueryDelimitedResponse -func (c *ClientWithResponses) GetQueryDelimitedWithResponse(ctx context.Context, params *GetQueryDelimitedParams, reqEditors ...RequestEditorFn) (*GetQueryDelimitedResponse, error) { - rsp, err := c.GetQueryDelimited(ctx, params, reqEditors...) - if err != nil { - return nil, err - } - return ParseGetQueryDelimitedResponse(rsp) -} - -// GetQueryFormWithResponse request returning *GetQueryFormResponse -func (c *ClientWithResponses) GetQueryFormWithResponse(ctx context.Context, params *GetQueryFormParams, reqEditors ...RequestEditorFn) (*GetQueryFormResponse, error) { - rsp, err := c.GetQueryForm(ctx, params, reqEditors...) - if err != nil { - return nil, err - } - return ParseGetQueryFormResponse(rsp) -} - -// GetSimpleExplodeArrayWithResponse request returning *GetSimpleExplodeArrayResponse -func (c *ClientWithResponses) GetSimpleExplodeArrayWithResponse(ctx context.Context, param []int32, reqEditors ...RequestEditorFn) (*GetSimpleExplodeArrayResponse, error) { - rsp, err := c.GetSimpleExplodeArray(ctx, param, reqEditors...) - if err != nil { - return nil, err - } - return ParseGetSimpleExplodeArrayResponse(rsp) -} - -// GetSimpleExplodeObjectWithResponse request returning *GetSimpleExplodeObjectResponse -func (c *ClientWithResponses) GetSimpleExplodeObjectWithResponse(ctx context.Context, param Object, reqEditors ...RequestEditorFn) (*GetSimpleExplodeObjectResponse, error) { - rsp, err := c.GetSimpleExplodeObject(ctx, param, reqEditors...) - if err != nil { - return nil, err - } - return ParseGetSimpleExplodeObjectResponse(rsp) -} - -// GetSimpleExplodePrimitiveWithResponse request returning *GetSimpleExplodePrimitiveResponse -func (c *ClientWithResponses) GetSimpleExplodePrimitiveWithResponse(ctx context.Context, param int32, reqEditors ...RequestEditorFn) (*GetSimpleExplodePrimitiveResponse, error) { - rsp, err := c.GetSimpleExplodePrimitive(ctx, param, reqEditors...) - if err != nil { - return nil, err - } - return ParseGetSimpleExplodePrimitiveResponse(rsp) -} - -// GetSimpleNoExplodeArrayWithResponse request returning *GetSimpleNoExplodeArrayResponse -func (c *ClientWithResponses) GetSimpleNoExplodeArrayWithResponse(ctx context.Context, param []int32, reqEditors ...RequestEditorFn) (*GetSimpleNoExplodeArrayResponse, error) { - rsp, err := c.GetSimpleNoExplodeArray(ctx, param, reqEditors...) - if err != nil { - return nil, err - } - return ParseGetSimpleNoExplodeArrayResponse(rsp) -} - -// GetSimpleNoExplodeObjectWithResponse request returning *GetSimpleNoExplodeObjectResponse -func (c *ClientWithResponses) GetSimpleNoExplodeObjectWithResponse(ctx context.Context, param Object, reqEditors ...RequestEditorFn) (*GetSimpleNoExplodeObjectResponse, error) { - rsp, err := c.GetSimpleNoExplodeObject(ctx, param, reqEditors...) - if err != nil { - return nil, err - } - return ParseGetSimpleNoExplodeObjectResponse(rsp) -} - -// GetSimplePrimitiveWithResponse request returning *GetSimplePrimitiveResponse -func (c *ClientWithResponses) GetSimplePrimitiveWithResponse(ctx context.Context, param int32, reqEditors ...RequestEditorFn) (*GetSimplePrimitiveResponse, error) { - rsp, err := c.GetSimplePrimitive(ctx, param, reqEditors...) - if err != nil { - return nil, err - } - return ParseGetSimplePrimitiveResponse(rsp) -} - -// GetStartingWithNumberWithResponse request returning *GetStartingWithNumberResponse -func (c *ClientWithResponses) GetStartingWithNumberWithResponse(ctx context.Context, n1param string, reqEditors ...RequestEditorFn) (*GetStartingWithNumberResponse, error) { - rsp, err := c.GetStartingWithNumber(ctx, n1param, reqEditors...) - if err != nil { - return nil, err - } - return ParseGetStartingWithNumberResponse(rsp) -} - -// ParseGetContentObjectResponse parses an HTTP response from a GetContentObjectWithResponse call -func ParseGetContentObjectResponse(rsp *http.Response) (*GetContentObjectResponse, error) { - bodyBytes, err := io.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &GetContentObjectResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - return response, nil -} - -// ParseGetCookieResponse parses an HTTP response from a GetCookieWithResponse call -func ParseGetCookieResponse(rsp *http.Response) (*GetCookieResponse, error) { - bodyBytes, err := io.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &GetCookieResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - return response, nil -} - -// ParseEnumParamsResponse parses an HTTP response from a EnumParamsWithResponse call -func ParseEnumParamsResponse(rsp *http.Response) (*EnumParamsResponse, error) { - bodyBytes, err := io.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &EnumParamsResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - return response, nil -} - -// ParseGetHeaderResponse parses an HTTP response from a GetHeaderWithResponse call -func ParseGetHeaderResponse(rsp *http.Response) (*GetHeaderResponse, error) { - bodyBytes, err := io.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &GetHeaderResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - return response, nil -} - -// ParseGetLabelExplodeArrayResponse parses an HTTP response from a GetLabelExplodeArrayWithResponse call -func ParseGetLabelExplodeArrayResponse(rsp *http.Response) (*GetLabelExplodeArrayResponse, error) { - bodyBytes, err := io.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &GetLabelExplodeArrayResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - return response, nil -} - -// ParseGetLabelExplodeObjectResponse parses an HTTP response from a GetLabelExplodeObjectWithResponse call -func ParseGetLabelExplodeObjectResponse(rsp *http.Response) (*GetLabelExplodeObjectResponse, error) { - bodyBytes, err := io.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &GetLabelExplodeObjectResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - return response, nil -} - -// ParseGetLabelExplodePrimitiveResponse parses an HTTP response from a GetLabelExplodePrimitiveWithResponse call -func ParseGetLabelExplodePrimitiveResponse(rsp *http.Response) (*GetLabelExplodePrimitiveResponse, error) { - bodyBytes, err := io.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &GetLabelExplodePrimitiveResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - return response, nil -} - -// ParseGetLabelNoExplodeArrayResponse parses an HTTP response from a GetLabelNoExplodeArrayWithResponse call -func ParseGetLabelNoExplodeArrayResponse(rsp *http.Response) (*GetLabelNoExplodeArrayResponse, error) { - bodyBytes, err := io.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &GetLabelNoExplodeArrayResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - return response, nil -} - -// ParseGetLabelNoExplodeObjectResponse parses an HTTP response from a GetLabelNoExplodeObjectWithResponse call -func ParseGetLabelNoExplodeObjectResponse(rsp *http.Response) (*GetLabelNoExplodeObjectResponse, error) { - bodyBytes, err := io.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &GetLabelNoExplodeObjectResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - return response, nil -} - -// ParseGetLabelPrimitiveResponse parses an HTTP response from a GetLabelPrimitiveWithResponse call -func ParseGetLabelPrimitiveResponse(rsp *http.Response) (*GetLabelPrimitiveResponse, error) { - bodyBytes, err := io.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &GetLabelPrimitiveResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - return response, nil -} - -// ParseGetMatrixExplodeArrayResponse parses an HTTP response from a GetMatrixExplodeArrayWithResponse call -func ParseGetMatrixExplodeArrayResponse(rsp *http.Response) (*GetMatrixExplodeArrayResponse, error) { - bodyBytes, err := io.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &GetMatrixExplodeArrayResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - return response, nil -} - -// ParseGetMatrixExplodeObjectResponse parses an HTTP response from a GetMatrixExplodeObjectWithResponse call -func ParseGetMatrixExplodeObjectResponse(rsp *http.Response) (*GetMatrixExplodeObjectResponse, error) { - bodyBytes, err := io.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &GetMatrixExplodeObjectResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - return response, nil -} - -// ParseGetMatrixExplodePrimitiveResponse parses an HTTP response from a GetMatrixExplodePrimitiveWithResponse call -func ParseGetMatrixExplodePrimitiveResponse(rsp *http.Response) (*GetMatrixExplodePrimitiveResponse, error) { - bodyBytes, err := io.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &GetMatrixExplodePrimitiveResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - return response, nil -} - -// ParseGetMatrixNoExplodeArrayResponse parses an HTTP response from a GetMatrixNoExplodeArrayWithResponse call -func ParseGetMatrixNoExplodeArrayResponse(rsp *http.Response) (*GetMatrixNoExplodeArrayResponse, error) { - bodyBytes, err := io.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &GetMatrixNoExplodeArrayResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - return response, nil -} - -// ParseGetMatrixNoExplodeObjectResponse parses an HTTP response from a GetMatrixNoExplodeObjectWithResponse call -func ParseGetMatrixNoExplodeObjectResponse(rsp *http.Response) (*GetMatrixNoExplodeObjectResponse, error) { - bodyBytes, err := io.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &GetMatrixNoExplodeObjectResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - return response, nil -} - -// ParseGetMatrixPrimitiveResponse parses an HTTP response from a GetMatrixPrimitiveWithResponse call -func ParseGetMatrixPrimitiveResponse(rsp *http.Response) (*GetMatrixPrimitiveResponse, error) { - bodyBytes, err := io.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &GetMatrixPrimitiveResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - return response, nil -} - -// ParseGetPassThroughResponse parses an HTTP response from a GetPassThroughWithResponse call -func ParseGetPassThroughResponse(rsp *http.Response) (*GetPassThroughResponse, error) { - bodyBytes, err := io.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &GetPassThroughResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - return response, nil -} - -// ParseGetDeepObjectResponse parses an HTTP response from a GetDeepObjectWithResponse call -func ParseGetDeepObjectResponse(rsp *http.Response) (*GetDeepObjectResponse, error) { - bodyBytes, err := io.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &GetDeepObjectResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - return response, nil -} - -// ParseGetQueryDelimitedResponse parses an HTTP response from a GetQueryDelimitedWithResponse call -func ParseGetQueryDelimitedResponse(rsp *http.Response) (*GetQueryDelimitedResponse, error) { - bodyBytes, err := io.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &GetQueryDelimitedResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - return response, nil -} - -// ParseGetQueryFormResponse parses an HTTP response from a GetQueryFormWithResponse call -func ParseGetQueryFormResponse(rsp *http.Response) (*GetQueryFormResponse, error) { - bodyBytes, err := io.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &GetQueryFormResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - return response, nil -} - -// ParseGetSimpleExplodeArrayResponse parses an HTTP response from a GetSimpleExplodeArrayWithResponse call -func ParseGetSimpleExplodeArrayResponse(rsp *http.Response) (*GetSimpleExplodeArrayResponse, error) { - bodyBytes, err := io.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &GetSimpleExplodeArrayResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - return response, nil -} - -// ParseGetSimpleExplodeObjectResponse parses an HTTP response from a GetSimpleExplodeObjectWithResponse call -func ParseGetSimpleExplodeObjectResponse(rsp *http.Response) (*GetSimpleExplodeObjectResponse, error) { - bodyBytes, err := io.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &GetSimpleExplodeObjectResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - return response, nil -} - -// ParseGetSimpleExplodePrimitiveResponse parses an HTTP response from a GetSimpleExplodePrimitiveWithResponse call -func ParseGetSimpleExplodePrimitiveResponse(rsp *http.Response) (*GetSimpleExplodePrimitiveResponse, error) { - bodyBytes, err := io.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &GetSimpleExplodePrimitiveResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - return response, nil -} - -// ParseGetSimpleNoExplodeArrayResponse parses an HTTP response from a GetSimpleNoExplodeArrayWithResponse call -func ParseGetSimpleNoExplodeArrayResponse(rsp *http.Response) (*GetSimpleNoExplodeArrayResponse, error) { - bodyBytes, err := io.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &GetSimpleNoExplodeArrayResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - return response, nil -} - -// ParseGetSimpleNoExplodeObjectResponse parses an HTTP response from a GetSimpleNoExplodeObjectWithResponse call -func ParseGetSimpleNoExplodeObjectResponse(rsp *http.Response) (*GetSimpleNoExplodeObjectResponse, error) { - bodyBytes, err := io.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &GetSimpleNoExplodeObjectResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - return response, nil -} - -// ParseGetSimplePrimitiveResponse parses an HTTP response from a GetSimplePrimitiveWithResponse call -func ParseGetSimplePrimitiveResponse(rsp *http.Response) (*GetSimplePrimitiveResponse, error) { - bodyBytes, err := io.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &GetSimplePrimitiveResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - return response, nil -} - -// ParseGetStartingWithNumberResponse parses an HTTP response from a GetStartingWithNumberWithResponse call -func ParseGetStartingWithNumberResponse(rsp *http.Response) (*GetStartingWithNumberResponse, error) { - bodyBytes, err := io.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &GetStartingWithNumberResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - return response, nil -} diff --git a/internal/test/parameters/echov5/echov5_param_test.go b/internal/test/parameters/echov5/echov5_param_test.go deleted file mode 100644 index 12e5eb5206..0000000000 --- a/internal/test/parameters/echov5/echov5_param_test.go +++ /dev/null @@ -1,381 +0,0 @@ -package echov5params - -import ( - "encoding/json" - "net/http" - "net/http/httptest" - "testing" - - "github.com/labstack/echo/v5" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" -) - -func TestEchoV5ParameterRoundTrip(t *testing.T) { - var s Server - e := echo.New() - RegisterHandlers(e, &s) - testImpl(t, e) -} - -func testImpl(t *testing.T, handler http.Handler) { - t.Helper() - - server := "http://example.com" - - expectedObject := Object{ - FirstName: "Alex", - Role: "admin", - } - - expectedComplexObject := ComplexObject{ - Object: expectedObject, - Id: 12345, - IsAdmin: true, - } - - expectedArray := []int32{3, 4, 5} - - var expectedPrimitive int32 = 5 - - doRoundTrip := func(t *testing.T, req *http.Request, target interface{}) { - t.Helper() - req.RequestURI = req.URL.RequestURI() - rec := httptest.NewRecorder() - handler.ServeHTTP(rec, req) - if !assert.Equal(t, http.StatusOK, rec.Code, "server returned %d; body: %s", rec.Code, rec.Body.String()) { - return - } - if target != nil { - require.NoError(t, json.NewDecoder(rec.Body).Decode(target), "failed to decode response body") - } - } - - t.Run("path", func(t *testing.T) { - t.Run("simple", func(t *testing.T) { - t.Run("primitive", func(t *testing.T) { - req, err := NewGetSimplePrimitiveRequest(server, expectedPrimitive) - require.NoError(t, err) - var got int32 - doRoundTrip(t, req, &got) - assert.Equal(t, expectedPrimitive, got) - }) - t.Run("primitive explode", func(t *testing.T) { - req, err := NewGetSimpleExplodePrimitiveRequest(server, expectedPrimitive) - require.NoError(t, err) - var got int32 - doRoundTrip(t, req, &got) - assert.Equal(t, expectedPrimitive, got) - }) - t.Run("array noExplode", func(t *testing.T) { - req, err := NewGetSimpleNoExplodeArrayRequest(server, expectedArray) - require.NoError(t, err) - var got []int32 - doRoundTrip(t, req, &got) - assert.Equal(t, expectedArray, got) - }) - t.Run("array explode", func(t *testing.T) { - req, err := NewGetSimpleExplodeArrayRequest(server, expectedArray) - require.NoError(t, err) - var got []int32 - doRoundTrip(t, req, &got) - assert.Equal(t, expectedArray, got) - }) - t.Run("object noExplode", func(t *testing.T) { - req, err := NewGetSimpleNoExplodeObjectRequest(server, expectedObject) - require.NoError(t, err) - var got Object - doRoundTrip(t, req, &got) - assert.Equal(t, expectedObject, got) - }) - t.Run("object explode", func(t *testing.T) { - req, err := NewGetSimpleExplodeObjectRequest(server, expectedObject) - require.NoError(t, err) - var got Object - doRoundTrip(t, req, &got) - assert.Equal(t, expectedObject, got) - }) - }) - t.Run("label", func(t *testing.T) { - t.Run("primitive", func(t *testing.T) { - req, err := NewGetLabelPrimitiveRequest(server, expectedPrimitive) - require.NoError(t, err) - var got int32 - doRoundTrip(t, req, &got) - assert.Equal(t, expectedPrimitive, got) - }) - t.Run("primitive explode", func(t *testing.T) { - req, err := NewGetLabelExplodePrimitiveRequest(server, expectedPrimitive) - require.NoError(t, err) - var got int32 - doRoundTrip(t, req, &got) - assert.Equal(t, expectedPrimitive, got) - }) - t.Run("array noExplode", func(t *testing.T) { - req, err := NewGetLabelNoExplodeArrayRequest(server, expectedArray) - require.NoError(t, err) - var got []int32 - doRoundTrip(t, req, &got) - assert.Equal(t, expectedArray, got) - }) - t.Run("array explode", func(t *testing.T) { - req, err := NewGetLabelExplodeArrayRequest(server, expectedArray) - require.NoError(t, err) - var got []int32 - doRoundTrip(t, req, &got) - assert.Equal(t, expectedArray, got) - }) - t.Run("object noExplode", func(t *testing.T) { - req, err := NewGetLabelNoExplodeObjectRequest(server, expectedObject) - require.NoError(t, err) - var got Object - doRoundTrip(t, req, &got) - assert.Equal(t, expectedObject, got) - }) - t.Run("object explode", func(t *testing.T) { - req, err := NewGetLabelExplodeObjectRequest(server, expectedObject) - require.NoError(t, err) - var got Object - doRoundTrip(t, req, &got) - assert.Equal(t, expectedObject, got) - }) - }) - t.Run("matrix", func(t *testing.T) { - t.Run("primitive", func(t *testing.T) { - req, err := NewGetMatrixPrimitiveRequest(server, expectedPrimitive) - require.NoError(t, err) - var got int32 - doRoundTrip(t, req, &got) - assert.Equal(t, expectedPrimitive, got) - }) - t.Run("primitive explode", func(t *testing.T) { - req, err := NewGetMatrixExplodePrimitiveRequest(server, expectedPrimitive) - require.NoError(t, err) - var got int32 - doRoundTrip(t, req, &got) - assert.Equal(t, expectedPrimitive, got) - }) - t.Run("array noExplode", func(t *testing.T) { - req, err := NewGetMatrixNoExplodeArrayRequest(server, expectedArray) - require.NoError(t, err) - var got []int32 - doRoundTrip(t, req, &got) - assert.Equal(t, expectedArray, got) - }) - t.Run("array explode", func(t *testing.T) { - req, err := NewGetMatrixExplodeArrayRequest(server, expectedArray) - require.NoError(t, err) - var got []int32 - doRoundTrip(t, req, &got) - assert.Equal(t, expectedArray, got) - }) - t.Run("object noExplode", func(t *testing.T) { - req, err := NewGetMatrixNoExplodeObjectRequest(server, expectedObject) - require.NoError(t, err) - var got Object - doRoundTrip(t, req, &got) - assert.Equal(t, expectedObject, got) - }) - t.Run("object explode", func(t *testing.T) { - req, err := NewGetMatrixExplodeObjectRequest(server, expectedObject) - require.NoError(t, err) - var got Object - doRoundTrip(t, req, &got) - assert.Equal(t, expectedObject, got) - }) - }) - t.Run("content-based", func(t *testing.T) { - t.Run("json complex object", func(t *testing.T) { - req, err := NewGetContentObjectRequest(server, expectedComplexObject) - require.NoError(t, err) - var got ComplexObject - doRoundTrip(t, req, &got) - assert.Equal(t, expectedComplexObject, got) - }) - t.Run("passthrough string", func(t *testing.T) { - req, err := NewGetPassThroughRequest(server, "hello world") - require.NoError(t, err) - var got string - doRoundTrip(t, req, &got) - assert.Equal(t, "hello world", got) - }) - }) - }) - - t.Run("query", func(t *testing.T) { - t.Run("form", func(t *testing.T) { - expectedArray2 := []int32{6, 7, 8} - expectedObject2 := Object{FirstName: "Marcin", Role: "annoyed_at_swagger"} - var expectedPrimitive2 int32 = 100 - var expectedPrimitiveString = "123;456" - var expectedN1s = "111" - - t.Run("all params at once", func(t *testing.T) { - params := GetQueryFormParams{ - Ea: &expectedArray, A: &expectedArray2, - Eo: &expectedObject, O: &expectedObject2, - Ep: &expectedPrimitive, P: &expectedPrimitive2, - Ps: &expectedPrimitiveString, Co: &expectedComplexObject, N1s: &expectedN1s, - } - req, err := NewGetQueryFormRequest(server, ¶ms) - require.NoError(t, err) - var got GetQueryFormParams - doRoundTrip(t, req, &got) - assert.EqualValues(t, params, got) - }) - t.Run("exploded array only", func(t *testing.T) { - params := GetQueryFormParams{Ea: &expectedArray} - req, err := NewGetQueryFormRequest(server, ¶ms) - require.NoError(t, err) - var got GetQueryFormParams - doRoundTrip(t, req, &got) - require.NotNil(t, got.Ea) - assert.Equal(t, expectedArray, *got.Ea) - }) - t.Run("unexploded array only", func(t *testing.T) { - params := GetQueryFormParams{A: &expectedArray} - req, err := NewGetQueryFormRequest(server, ¶ms) - require.NoError(t, err) - var got GetQueryFormParams - doRoundTrip(t, req, &got) - require.NotNil(t, got.A) - assert.Equal(t, expectedArray, *got.A) - }) - t.Run("exploded object only", func(t *testing.T) { - params := GetQueryFormParams{Eo: &expectedObject} - req, err := NewGetQueryFormRequest(server, ¶ms) - require.NoError(t, err) - var got GetQueryFormParams - doRoundTrip(t, req, &got) - require.NotNil(t, got.Eo) - assert.Equal(t, expectedObject, *got.Eo) - }) - t.Run("unexploded object only", func(t *testing.T) { - params := GetQueryFormParams{O: &expectedObject} - req, err := NewGetQueryFormRequest(server, ¶ms) - require.NoError(t, err) - var got GetQueryFormParams - doRoundTrip(t, req, &got) - require.NotNil(t, got.O) - assert.Equal(t, expectedObject, *got.O) - }) - t.Run("primitive with semicolon", func(t *testing.T) { - params := GetQueryFormParams{Ps: &expectedPrimitiveString} - req, err := NewGetQueryFormRequest(server, ¶ms) - require.NoError(t, err) - var got GetQueryFormParams - doRoundTrip(t, req, &got) - require.NotNil(t, got.Ps) - assert.Equal(t, expectedPrimitiveString, *got.Ps) - }) - }) - t.Run("deepObject", func(t *testing.T) { - params := GetDeepObjectParams{DeepObj: expectedComplexObject} - req, err := NewGetDeepObjectRequest(server, ¶ms) - require.NoError(t, err) - var got GetDeepObjectParams - doRoundTrip(t, req, &got) - assert.Equal(t, expectedComplexObject, got.DeepObj) - }) - t.Run("spaceDelimited", func(t *testing.T) { - }) - t.Run("pipeDelimited", func(t *testing.T) { - }) - }) - - t.Run("header", func(t *testing.T) { - expectedArray2 := []int32{6, 7, 8} - expectedObject2 := Object{FirstName: "Marcin", Role: "annoyed_at_swagger"} - var expectedPrimitive2 int32 = 100 - var expectedN1s = "111" - - t.Run("all params at once", func(t *testing.T) { - params := GetHeaderParams{ - XPrimitive: &expectedPrimitive2, XPrimitiveExploded: &expectedPrimitive, - XArrayExploded: &expectedArray, XArray: &expectedArray2, - XObjectExploded: &expectedObject, XObject: &expectedObject2, - XComplexObject: &expectedComplexObject, N1StartingWithNumber: &expectedN1s, - } - req, err := NewGetHeaderRequest(server, ¶ms) - require.NoError(t, err) - var got GetHeaderParams - doRoundTrip(t, req, &got) - assert.EqualValues(t, params, got) - }) - t.Run("primitive only", func(t *testing.T) { - params := GetHeaderParams{XPrimitive: &expectedPrimitive} - req, err := NewGetHeaderRequest(server, ¶ms) - require.NoError(t, err) - var got GetHeaderParams - doRoundTrip(t, req, &got) - require.NotNil(t, got.XPrimitive) - assert.Equal(t, expectedPrimitive, *got.XPrimitive) - }) - t.Run("array only", func(t *testing.T) { - params := GetHeaderParams{XArray: &expectedArray} - req, err := NewGetHeaderRequest(server, ¶ms) - require.NoError(t, err) - var got GetHeaderParams - doRoundTrip(t, req, &got) - require.NotNil(t, got.XArray) - assert.Equal(t, expectedArray, *got.XArray) - }) - t.Run("object only", func(t *testing.T) { - params := GetHeaderParams{XObject: &expectedObject} - req, err := NewGetHeaderRequest(server, ¶ms) - require.NoError(t, err) - var got GetHeaderParams - doRoundTrip(t, req, &got) - require.NotNil(t, got.XObject) - assert.Equal(t, expectedObject, *got.XObject) - }) - }) - - t.Run("cookie", func(t *testing.T) { - expectedArray2 := []int32{6, 7, 8} - expectedObject2 := Object{FirstName: "Marcin", Role: "annoyed_at_swagger"} - var expectedPrimitive2 int32 = 100 - var expectedN1s = "111" - - t.Run("all params at once", func(t *testing.T) { - params := GetCookieParams{ - P: &expectedPrimitive2, Ep: &expectedPrimitive, - Ea: &expectedArray, A: &expectedArray2, - Eo: &expectedObject, O: &expectedObject2, - Co: &expectedComplexObject, N1s: &expectedN1s, - } - req, err := NewGetCookieRequest(server, ¶ms) - require.NoError(t, err) - var got GetCookieParams - doRoundTrip(t, req, &got) - assert.EqualValues(t, params, got) - }) - t.Run("primitive only", func(t *testing.T) { - params := GetCookieParams{P: &expectedPrimitive} - req, err := NewGetCookieRequest(server, ¶ms) - require.NoError(t, err) - var got GetCookieParams - doRoundTrip(t, req, &got) - require.NotNil(t, got.P) - assert.Equal(t, expectedPrimitive, *got.P) - }) - t.Run("array only", func(t *testing.T) { - params := GetCookieParams{A: &expectedArray} - req, err := NewGetCookieRequest(server, ¶ms) - require.NoError(t, err) - var got GetCookieParams - doRoundTrip(t, req, &got) - require.NotNil(t, got.A) - assert.Equal(t, expectedArray, *got.A) - }) - t.Run("object only", func(t *testing.T) { - params := GetCookieParams{O: &expectedObject} - req, err := NewGetCookieRequest(server, ¶ms) - require.NoError(t, err) - var got GetCookieParams - doRoundTrip(t, req, &got) - require.NotNil(t, got.O) - assert.Equal(t, expectedObject, *got.O) - }) - }) -} diff --git a/internal/test/parameters/echov5/server.gen.go b/internal/test/parameters/echov5/gen/server.gen.go similarity index 99% rename from internal/test/parameters/echov5/server.gen.go rename to internal/test/parameters/echov5/gen/server.gen.go index fa9568f23f..30bebc6b46 100644 --- a/internal/test/parameters/echov5/server.gen.go +++ b/internal/test/parameters/echov5/gen/server.gen.go @@ -1,7 +1,7 @@ -// Package echov5params provides primitives to interact with the openapi HTTP API. +// Package echov5paramsgen provides primitives to interact with the openapi HTTP API. // // Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.0.0-00010101000000-000000000000 DO NOT EDIT. -package echov5params +package echov5paramsgen import ( "bytes" diff --git a/internal/test/parameters/echov5/types.gen.go b/internal/test/parameters/echov5/gen/types.gen.go similarity index 97% rename from internal/test/parameters/echov5/types.gen.go rename to internal/test/parameters/echov5/gen/types.gen.go index ec30efbad9..f9ac88c94a 100644 --- a/internal/test/parameters/echov5/types.gen.go +++ b/internal/test/parameters/echov5/gen/types.gen.go @@ -1,7 +1,7 @@ -// Package echov5params provides primitives to interact with the openapi HTTP API. +// Package echov5paramsgen provides primitives to interact with the openapi HTTP API. // // Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.0.0-00010101000000-000000000000 DO NOT EDIT. -package echov5params +package echov5paramsgen // Defines values for EnumParamsParamsEnumPathParam. const ( diff --git a/internal/test/parameters/echov5/server.cfg.yaml b/internal/test/parameters/echov5/server.cfg.yaml index 49ef08e89f..6df3ac93c1 100644 --- a/internal/test/parameters/echov5/server.cfg.yaml +++ b/internal/test/parameters/echov5/server.cfg.yaml @@ -1,6 +1,6 @@ # yaml-language-server: $schema=../../../../configuration-schema.json -package: echov5params +package: echov5paramsgen generate: echo5-server: true embedded-spec: true -output: server.gen.go +output: gen/server.gen.go diff --git a/internal/test/parameters/echov5/server.go b/internal/test/parameters/echov5/server.go index 50e16af349..c14531f150 100644 --- a/internal/test/parameters/echov5/server.go +++ b/internal/test/parameters/echov5/server.go @@ -1,6 +1,5 @@ //go:generate go run github.com/oapi-codegen/oapi-codegen/v2/cmd/oapi-codegen --config=server.cfg.yaml ../parameters.yaml //go:generate go run github.com/oapi-codegen/oapi-codegen/v2/cmd/oapi-codegen --config=types.cfg.yaml ../parameters.yaml -//go:generate go run github.com/oapi-codegen/oapi-codegen/v2/cmd/oapi-codegen --config=client.cfg.yaml ../parameters.yaml package echov5params @@ -8,34 +7,38 @@ import ( "net/http" "github.com/labstack/echo/v5" + + gen "github.com/oapi-codegen/oapi-codegen/v2/internal/test/parameters/echov5/gen" ) type Server struct{} -func (s *Server) GetContentObject(ctx *echo.Context, param ComplexObject) error { return (*ctx).JSON(http.StatusOK, param) } -func (s *Server) GetCookie(ctx *echo.Context, params GetCookieParams) error { return (*ctx).JSON(http.StatusOK, params) } -func (s *Server) EnumParams(ctx *echo.Context, params EnumParamsParams) error { return (*ctx).NoContent(http.StatusNoContent) } -func (s *Server) GetHeader(ctx *echo.Context, params GetHeaderParams) error { return (*ctx).JSON(http.StatusOK, params) } -func (s *Server) GetLabelExplodeArray(ctx *echo.Context, param []int32) error { return (*ctx).JSON(http.StatusOK, param) } -func (s *Server) GetLabelExplodeObject(ctx *echo.Context, param Object) error { return (*ctx).JSON(http.StatusOK, param) } -func (s *Server) GetLabelExplodePrimitive(ctx *echo.Context, param int32) error { return (*ctx).JSON(http.StatusOK, param) } -func (s *Server) GetLabelNoExplodeArray(ctx *echo.Context, param []int32) error { return (*ctx).JSON(http.StatusOK, param) } -func (s *Server) GetLabelNoExplodeObject(ctx *echo.Context, param Object) error { return (*ctx).JSON(http.StatusOK, param) } -func (s *Server) GetLabelPrimitive(ctx *echo.Context, param int32) error { return (*ctx).JSON(http.StatusOK, param) } -func (s *Server) GetMatrixExplodeArray(ctx *echo.Context, id []int32) error { return (*ctx).JSON(http.StatusOK, id) } -func (s *Server) GetMatrixExplodeObject(ctx *echo.Context, id Object) error { return (*ctx).JSON(http.StatusOK, id) } -func (s *Server) GetMatrixExplodePrimitive(ctx *echo.Context, id int32) error { return (*ctx).JSON(http.StatusOK, id) } -func (s *Server) GetMatrixNoExplodeArray(ctx *echo.Context, id []int32) error { return (*ctx).JSON(http.StatusOK, id) } -func (s *Server) GetMatrixNoExplodeObject(ctx *echo.Context, id Object) error { return (*ctx).JSON(http.StatusOK, id) } -func (s *Server) GetMatrixPrimitive(ctx *echo.Context, id int32) error { return (*ctx).JSON(http.StatusOK, id) } -func (s *Server) GetPassThrough(ctx *echo.Context, param string) error { return (*ctx).JSON(http.StatusOK, param) } -func (s *Server) GetDeepObject(ctx *echo.Context, params GetDeepObjectParams) error { return (*ctx).JSON(http.StatusOK, params) } -func (s *Server) GetQueryDelimited(ctx *echo.Context, params GetQueryDelimitedParams) error { return (*ctx).JSON(http.StatusOK, params) } -func (s *Server) GetQueryForm(ctx *echo.Context, params GetQueryFormParams) error { return (*ctx).JSON(http.StatusOK, params) } -func (s *Server) GetSimpleExplodeArray(ctx *echo.Context, param []int32) error { return (*ctx).JSON(http.StatusOK, param) } -func (s *Server) GetSimpleExplodeObject(ctx *echo.Context, param Object) error { return (*ctx).JSON(http.StatusOK, param) } -func (s *Server) GetSimpleExplodePrimitive(ctx *echo.Context, param int32) error { return (*ctx).JSON(http.StatusOK, param) } -func (s *Server) GetSimpleNoExplodeArray(ctx *echo.Context, param []int32) error { return (*ctx).JSON(http.StatusOK, param) } -func (s *Server) GetSimpleNoExplodeObject(ctx *echo.Context, param Object) error { return (*ctx).JSON(http.StatusOK, param) } -func (s *Server) GetSimplePrimitive(ctx *echo.Context, param int32) error { return (*ctx).JSON(http.StatusOK, param) } -func (s *Server) GetStartingWithNumber(ctx *echo.Context, n1param string) error { return (*ctx).JSON(http.StatusOK, n1param) } +var _ gen.ServerInterface = (*Server)(nil) + +func (s *Server) GetContentObject(ctx *echo.Context, param gen.ComplexObject) error { return (*ctx).JSON(http.StatusOK, param) } +func (s *Server) GetCookie(ctx *echo.Context, params gen.GetCookieParams) error { return (*ctx).JSON(http.StatusOK, params) } +func (s *Server) EnumParams(ctx *echo.Context, params gen.EnumParamsParams) error { return (*ctx).NoContent(http.StatusNoContent) } +func (s *Server) GetHeader(ctx *echo.Context, params gen.GetHeaderParams) error { return (*ctx).JSON(http.StatusOK, params) } +func (s *Server) GetLabelExplodeArray(ctx *echo.Context, param []int32) error { return (*ctx).JSON(http.StatusOK, param) } +func (s *Server) GetLabelExplodeObject(ctx *echo.Context, param gen.Object) error { return (*ctx).JSON(http.StatusOK, param) } +func (s *Server) GetLabelExplodePrimitive(ctx *echo.Context, param int32) error { return (*ctx).JSON(http.StatusOK, param) } +func (s *Server) GetLabelNoExplodeArray(ctx *echo.Context, param []int32) error { return (*ctx).JSON(http.StatusOK, param) } +func (s *Server) GetLabelNoExplodeObject(ctx *echo.Context, param gen.Object) error { return (*ctx).JSON(http.StatusOK, param) } +func (s *Server) GetLabelPrimitive(ctx *echo.Context, param int32) error { return (*ctx).JSON(http.StatusOK, param) } +func (s *Server) GetMatrixExplodeArray(ctx *echo.Context, id []int32) error { return (*ctx).JSON(http.StatusOK, id) } +func (s *Server) GetMatrixExplodeObject(ctx *echo.Context, id gen.Object) error { return (*ctx).JSON(http.StatusOK, id) } +func (s *Server) GetMatrixExplodePrimitive(ctx *echo.Context, id int32) error { return (*ctx).JSON(http.StatusOK, id) } +func (s *Server) GetMatrixNoExplodeArray(ctx *echo.Context, id []int32) error { return (*ctx).JSON(http.StatusOK, id) } +func (s *Server) GetMatrixNoExplodeObject(ctx *echo.Context, id gen.Object) error { return (*ctx).JSON(http.StatusOK, id) } +func (s *Server) GetMatrixPrimitive(ctx *echo.Context, id int32) error { return (*ctx).JSON(http.StatusOK, id) } +func (s *Server) GetPassThrough(ctx *echo.Context, param string) error { return (*ctx).JSON(http.StatusOK, param) } +func (s *Server) GetDeepObject(ctx *echo.Context, params gen.GetDeepObjectParams) error { return (*ctx).JSON(http.StatusOK, params) } +func (s *Server) GetQueryDelimited(ctx *echo.Context, params gen.GetQueryDelimitedParams) error { return (*ctx).JSON(http.StatusOK, params) } +func (s *Server) GetQueryForm(ctx *echo.Context, params gen.GetQueryFormParams) error { return (*ctx).JSON(http.StatusOK, params) } +func (s *Server) GetSimpleExplodeArray(ctx *echo.Context, param []int32) error { return (*ctx).JSON(http.StatusOK, param) } +func (s *Server) GetSimpleExplodeObject(ctx *echo.Context, param gen.Object) error { return (*ctx).JSON(http.StatusOK, param) } +func (s *Server) GetSimpleExplodePrimitive(ctx *echo.Context, param int32) error { return (*ctx).JSON(http.StatusOK, param) } +func (s *Server) GetSimpleNoExplodeArray(ctx *echo.Context, param []int32) error { return (*ctx).JSON(http.StatusOK, param) } +func (s *Server) GetSimpleNoExplodeObject(ctx *echo.Context, param gen.Object) error { return (*ctx).JSON(http.StatusOK, param) } +func (s *Server) GetSimplePrimitive(ctx *echo.Context, param int32) error { return (*ctx).JSON(http.StatusOK, param) } +func (s *Server) GetStartingWithNumber(ctx *echo.Context, n1param string) error { return (*ctx).JSON(http.StatusOK, n1param) } diff --git a/internal/test/parameters/echov5/types.cfg.yaml b/internal/test/parameters/echov5/types.cfg.yaml index 7cf80b491c..97fafeae65 100644 --- a/internal/test/parameters/echov5/types.cfg.yaml +++ b/internal/test/parameters/echov5/types.cfg.yaml @@ -1,5 +1,5 @@ # yaml-language-server: $schema=../../../../configuration-schema.json -package: echov5params +package: echov5paramsgen generate: models: true -output: types.gen.go +output: gen/types.gen.go diff --git a/internal/test/parameters/param_roundtrip_test.go b/internal/test/parameters/param_roundtrip_test.go index 2bca8801e3..6a64a99040 100644 --- a/internal/test/parameters/param_roundtrip_test.go +++ b/internal/test/parameters/param_roundtrip_test.go @@ -13,6 +13,7 @@ import ( "github.com/gorilla/mux" "github.com/kataras/iris/v12" "github.com/labstack/echo/v4" + echov5 "github.com/labstack/echo/v5" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" @@ -21,6 +22,8 @@ import ( paramclient "github.com/oapi-codegen/oapi-codegen/v2/internal/test/parameters/client/gen" echoparams "github.com/oapi-codegen/oapi-codegen/v2/internal/test/parameters/echo" echogen "github.com/oapi-codegen/oapi-codegen/v2/internal/test/parameters/echo/gen" + echov5params "github.com/oapi-codegen/oapi-codegen/v2/internal/test/parameters/echov5" + echov5gen "github.com/oapi-codegen/oapi-codegen/v2/internal/test/parameters/echov5/gen" fiberparams "github.com/oapi-codegen/oapi-codegen/v2/internal/test/parameters/fiber" fibergen "github.com/oapi-codegen/oapi-codegen/v2/internal/test/parameters/fiber/gen" ginparams "github.com/oapi-codegen/oapi-codegen/v2/internal/test/parameters/gin" @@ -40,6 +43,13 @@ func TestEchoParameterRoundTrip(t *testing.T) { testImpl(t, e) } +func TestEchoV5ParameterRoundTrip(t *testing.T) { + var s echov5params.Server + e := echov5.New() + echov5gen.RegisterHandlers(e, &s) + testImpl(t, e) +} + func TestChiParameterRoundTrip(t *testing.T) { var s chiparams.Server r := chi.NewRouter()