diff --git a/samples/gen-go-basic/client/client.go b/samples/gen-go-basic/client/client.go
index 2c26f768..144db4be 100644
--- a/samples/gen-go-basic/client/client.go
+++ b/samples/gen-go-basic/client/client.go
@@ -1312,6 +1312,116 @@ func (c *WagClient) doHealthCheckRequest(ctx context.Context, req *http.Request,
}
}
+// LowercaseModelsTest makes a POST request to /lowercaseModelsTest/{pathParam}
+// testing that we can use a lowercase name for a model
+// 200: nil
+// 400: *models.BadRequest
+// 500: *models.InternalError
+// default: client side HTTP errors, for example: context.DeadlineExceeded.
+func (c *WagClient) LowercaseModelsTest(ctx context.Context, i *models.LowercaseModelsTestInput) error {
+ headers := make(map[string]string)
+
+ var body []byte
+ path, err := i.Path()
+
+ if err != nil {
+ return err
+ }
+
+ path = c.basePath + path
+
+ if i.Lowercase != nil {
+
+ var err error
+ body, err = json.Marshal(i.Lowercase)
+
+ if err != nil {
+ return err
+ }
+
+ }
+
+ req, err := http.NewRequestWithContext(ctx, "POST", path, bytes.NewBuffer(body))
+
+ if err != nil {
+ return err
+ }
+
+ return c.doLowercaseModelsTestRequest(ctx, req, headers)
+}
+
+func (c *WagClient) doLowercaseModelsTestRequest(ctx context.Context, req *http.Request, headers map[string]string) error {
+ req.Header.Set("Content-Type", "application/json")
+ req.Header.Set("Canonical-Resource", "lowercaseModelsTest")
+ req.Header.Set(VersionHeader, Version)
+
+ for field, value := range headers {
+ req.Header.Set(field, value)
+ }
+
+ // Add the opname for doers like tracing
+ ctx = context.WithValue(ctx, opNameCtx{}, "lowercaseModelsTest")
+ req = req.WithContext(ctx)
+ // Don't add the timeout in a "doer" because we don't want to call "defer.cancel()"
+ // until we've finished all the processing of the request object. Otherwise we'll cancel
+ // our own request before we've finished it.
+ if c.defaultTimeout != 0 {
+ ctx, cancel := context.WithTimeout(req.Context(), c.defaultTimeout)
+ defer cancel()
+ req = req.WithContext(ctx)
+ }
+
+ resp, err := c.requestDoer.Do(c.client, req)
+ retCode := 0
+ if resp != nil {
+ retCode = resp.StatusCode
+ }
+
+ // log all client failures and non-successful HT
+ logData := map[string]interface{}{
+ "backend": "swagger-test",
+ "method": req.Method,
+ "uri": req.URL,
+ "status_code": retCode,
+ }
+ if err == nil && retCode > 399 {
+ logData["message"] = resp.Status
+ c.logger.Log(wcl.Error, "client-request-finished", logData)
+ }
+ if err != nil {
+ logData["message"] = err.Error()
+ c.logger.Log(wcl.Error, "client-request-finished", logData)
+ return err
+ }
+ defer resp.Body.Close()
+ switch resp.StatusCode {
+
+ case 200:
+
+ return nil
+
+ case 400:
+
+ var output models.BadRequest
+ if err := json.NewDecoder(resp.Body).Decode(&output); err != nil {
+ return err
+ }
+ return &output
+
+ case 500:
+
+ var output models.InternalError
+ if err := json.NewDecoder(resp.Body).Decode(&output); err != nil {
+ return err
+ }
+ return &output
+
+ default:
+ bs, _ := ioutil.ReadAll(resp.Body)
+ return models.UnknownResponse{StatusCode: int64(resp.StatusCode), Body: string(bs)}
+ }
+}
+
func shortHash(s string) string {
return fmt.Sprintf("%x", md5.Sum([]byte(s)))[0:6]
}
diff --git a/samples/gen-go-basic/client/interface.go b/samples/gen-go-basic/client/interface.go
index 41b8f732..43315857 100644
--- a/samples/gen-go-basic/client/interface.go
+++ b/samples/gen-go-basic/client/interface.go
@@ -83,6 +83,14 @@ type Client interface {
// 500: *models.InternalError
// default: client side HTTP errors, for example: context.DeadlineExceeded.
HealthCheck(ctx context.Context) error
+
+ // LowercaseModelsTest makes a POST request to /lowercaseModelsTest/{pathParam}
+ // testing that we can use a lowercase name for a model
+ // 200: nil
+ // 400: *models.BadRequest
+ // 500: *models.InternalError
+ // default: client side HTTP errors, for example: context.DeadlineExceeded.
+ LowercaseModelsTest(ctx context.Context, i *models.LowercaseModelsTestInput) error
}
// GetAuthorsIter defines the methods available on GetAuthors iterators.
diff --git a/samples/gen-go-basic/models/inputs.go b/samples/gen-go-basic/models/inputs.go
index 0aae0bd7..7d240d3b 100644
--- a/samples/gen-go-basic/models/inputs.go
+++ b/samples/gen-go-basic/models/inputs.go
@@ -338,3 +338,39 @@ func (i HealthCheckInput) Path() (string, error) {
return path + "?" + urlVals.Encode(), nil
}
+
+// LowercaseModelsTestInput holds the input parameters for a lowercaseModelsTest operation.
+type LowercaseModelsTestInput struct {
+ Lowercase *lowercase
+ PathParam string
+}
+
+// Validate returns an error if any of the LowercaseModelsTestInput parameters don't satisfy the
+// requirements from the swagger yml file.
+func (i LowercaseModelsTestInput) Validate() error {
+
+ if i.Lowercase != nil {
+ if err := i.Lowercase.Validate(nil); err != nil {
+ return err
+ }
+ }
+
+ return nil
+}
+
+// Path returns the URI path for the input.
+func (i LowercaseModelsTestInput) Path() (string, error) {
+ path := "/v1/lowercaseModelsTest/{pathParam}"
+ urlVals := url.Values{}
+
+ pathpathParam := i.PathParam
+ if pathpathParam == "" {
+ err := fmt.Errorf("pathParam cannot be empty because it's a path parameter")
+ if err != nil {
+ return "", err
+ }
+ }
+ path = strings.Replace(path, "{pathParam}", pathpathParam, -1)
+
+ return path + "?" + urlVals.Encode(), nil
+}
diff --git a/samples/gen-go-basic/models/lowercase.go b/samples/gen-go-basic/models/lowercase.go
new file mode 100644
index 00000000..c587305f
--- /dev/null
+++ b/samples/gen-go-basic/models/lowercase.go
@@ -0,0 +1,11 @@
+// Code generated by go-swagger; DO NOT EDIT.
+
+package models
+
+// This file was generated by the swagger tool.
+// Editing this file might prove futile when you re-run the swagger generate command
+
+// Lowercase lowercase
+//
+// swagger:model lowercase
+type Lowercase interface{}
diff --git a/samples/gen-go-basic/server/handlers.go b/samples/gen-go-basic/server/handlers.go
index 44d3c4ec..00309bcf 100644
--- a/samples/gen-go-basic/server/handlers.go
+++ b/samples/gen-go-basic/server/handlers.go
@@ -1057,3 +1057,103 @@ func newHealthCheckInput(r *http.Request) (*models.HealthCheckInput, error) {
return &input, nil
}
+
+// statusCodeForLowercaseModelsTest returns the status code corresponding to the returned
+// object. It returns -1 if the type doesn't correspond to anything.
+func statusCodeForLowercaseModelsTest(obj interface{}) int {
+
+ switch obj.(type) {
+
+ case *models.BadRequest:
+ return 400
+
+ case *models.InternalError:
+ return 500
+
+ case models.BadRequest:
+ return 400
+
+ case models.InternalError:
+ return 500
+
+ default:
+ return -1
+ }
+}
+
+func (h handler) LowercaseModelsTestHandler(ctx context.Context, w http.ResponseWriter, r *http.Request) {
+
+ input, err := newLowercaseModelsTestInput(r)
+ if err != nil {
+ logger.FromContext(ctx).AddContext("error", err.Error())
+ http.Error(w, jsonMarshalNoError(models.BadRequest{Message: err.Error()}), http.StatusBadRequest)
+ return
+ }
+
+ err = input.Validate()
+
+ if err != nil {
+ logger.FromContext(ctx).AddContext("error", err.Error())
+ http.Error(w, jsonMarshalNoError(models.BadRequest{Message: err.Error()}), http.StatusBadRequest)
+ return
+ }
+
+ err = h.LowercaseModelsTest(ctx, input)
+
+ if err != nil {
+ logger.FromContext(ctx).AddContext("error", err.Error())
+ if btErr, ok := err.(*errors.Error); ok {
+ logger.FromContext(ctx).AddContext("stacktrace", string(btErr.Stack()))
+ } else if xerr, ok := err.(xerrors.Formatter); ok {
+ logger.FromContext(ctx).AddContext("frames", fmt.Sprintf("%+v", xerr))
+ }
+ statusCode := statusCodeForLowercaseModelsTest(err)
+ if statusCode == -1 {
+ err = models.InternalError{Message: err.Error()}
+ statusCode = 500
+ }
+ http.Error(w, jsonMarshalNoError(err), statusCode)
+ return
+ }
+
+ w.WriteHeader(200)
+ w.Write([]byte(""))
+
+}
+
+// newLowercaseModelsTestInput takes in an http.Request an returns the input struct.
+func newLowercaseModelsTestInput(r *http.Request) (*models.LowercaseModelsTestInput, error) {
+ var input models.LowercaseModelsTestInput
+
+ var err error
+ _ = err
+
+ data, err := ioutil.ReadAll(r.Body)
+ if len(data) == 0 {
+ return nil, errors.New("request body is required, but was empty")
+ }
+ if len(data) > 0 {
+ input.Lowercase = &models.lowercase{}
+ if err := json.NewDecoder(bytes.NewReader(data)).Decode(input.Lowercase); err != nil {
+ return nil, err
+ }
+ }
+
+ pathParamStr := mux.Vars(r)["pathParam"]
+ if len(pathParamStr) == 0 {
+ return nil, errors.New("path parameter 'pathParam' must be specified")
+ }
+ pathParamStrs := []string{pathParamStr}
+
+ if len(pathParamStrs) > 0 {
+ var pathParamTmp string
+ pathParamStr := pathParamStrs[0]
+ pathParamTmp, err = pathParamStr, error(nil)
+ if err != nil {
+ return nil, err
+ }
+ input.PathParam = pathParamTmp
+ }
+
+ return &input, nil
+}
diff --git a/samples/gen-go-basic/server/interface.go b/samples/gen-go-basic/server/interface.go
index df9a2dd9..f61f1416 100644
--- a/samples/gen-go-basic/server/interface.go
+++ b/samples/gen-go-basic/server/interface.go
@@ -80,4 +80,12 @@ type Controller interface {
// 500: *models.InternalError
// default: client side HTTP errors, for example: context.DeadlineExceeded.
HealthCheck(ctx context.Context) error
+
+ // LowercaseModelsTest handles POST requests to /lowercaseModelsTest/{pathParam}
+ // testing that we can use a lowercase name for a model
+ // 200: nil
+ // 400: *models.BadRequest
+ // 500: *models.InternalError
+ // default: client side HTTP errors, for example: context.DeadlineExceeded.
+ LowercaseModelsTest(ctx context.Context, i *models.LowercaseModelsTestInput) error
}
diff --git a/samples/gen-go-basic/server/router.go b/samples/gen-go-basic/server/router.go
index 37521945..1456eef1 100644
--- a/samples/gen-go-basic/server/router.go
+++ b/samples/gen-go-basic/server/router.go
@@ -179,6 +179,11 @@ func newRouter(c Controller) *mux.Router {
h.HealthCheckHandler(r.Context(), w, r)
})
+ router.Methods("POST").Path("/v1/lowercaseModelsTest/{pathParam}").HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+ logger.FromContext(r.Context()).AddContext("op", "lowercaseModelsTest")
+ h.LowercaseModelsTestHandler(r.Context(), w, r)
+ })
+
return router
}
diff --git a/samples/gen-go-client-only/client/client.go b/samples/gen-go-client-only/client/client.go
index 56bf32ba..51312ae2 100644
--- a/samples/gen-go-client-only/client/client.go
+++ b/samples/gen-go-client-only/client/client.go
@@ -1312,6 +1312,116 @@ func (c *WagClient) doHealthCheckRequest(ctx context.Context, req *http.Request,
}
}
+// LowercaseModelsTest makes a POST request to /lowercaseModelsTest/{pathParam}
+// testing that we can use a lowercase name for a model
+// 200: nil
+// 400: *models.BadRequest
+// 500: *models.InternalError
+// default: client side HTTP errors, for example: context.DeadlineExceeded.
+func (c *WagClient) LowercaseModelsTest(ctx context.Context, i *models.LowercaseModelsTestInput) error {
+ headers := make(map[string]string)
+
+ var body []byte
+ path, err := i.Path()
+
+ if err != nil {
+ return err
+ }
+
+ path = c.basePath + path
+
+ if i.Lowercase != nil {
+
+ var err error
+ body, err = json.Marshal(i.Lowercase)
+
+ if err != nil {
+ return err
+ }
+
+ }
+
+ req, err := http.NewRequestWithContext(ctx, "POST", path, bytes.NewBuffer(body))
+
+ if err != nil {
+ return err
+ }
+
+ return c.doLowercaseModelsTestRequest(ctx, req, headers)
+}
+
+func (c *WagClient) doLowercaseModelsTestRequest(ctx context.Context, req *http.Request, headers map[string]string) error {
+ req.Header.Set("Content-Type", "application/json")
+ req.Header.Set("Canonical-Resource", "lowercaseModelsTest")
+ req.Header.Set(VersionHeader, Version)
+
+ for field, value := range headers {
+ req.Header.Set(field, value)
+ }
+
+ // Add the opname for doers like tracing
+ ctx = context.WithValue(ctx, opNameCtx{}, "lowercaseModelsTest")
+ req = req.WithContext(ctx)
+ // Don't add the timeout in a "doer" because we don't want to call "defer.cancel()"
+ // until we've finished all the processing of the request object. Otherwise we'll cancel
+ // our own request before we've finished it.
+ if c.defaultTimeout != 0 {
+ ctx, cancel := context.WithTimeout(req.Context(), c.defaultTimeout)
+ defer cancel()
+ req = req.WithContext(ctx)
+ }
+
+ resp, err := c.requestDoer.Do(c.client, req)
+ retCode := 0
+ if resp != nil {
+ retCode = resp.StatusCode
+ }
+
+ // log all client failures and non-successful HT
+ logData := map[string]interface{}{
+ "backend": "swagger-test",
+ "method": req.Method,
+ "uri": req.URL,
+ "status_code": retCode,
+ }
+ if err == nil && retCode > 399 {
+ logData["message"] = resp.Status
+ c.logger.Log(wcl.Error, "client-request-finished", logData)
+ }
+ if err != nil {
+ logData["message"] = err.Error()
+ c.logger.Log(wcl.Error, "client-request-finished", logData)
+ return err
+ }
+ defer resp.Body.Close()
+ switch resp.StatusCode {
+
+ case 200:
+
+ return nil
+
+ case 400:
+
+ var output models.BadRequest
+ if err := json.NewDecoder(resp.Body).Decode(&output); err != nil {
+ return err
+ }
+ return &output
+
+ case 500:
+
+ var output models.InternalError
+ if err := json.NewDecoder(resp.Body).Decode(&output); err != nil {
+ return err
+ }
+ return &output
+
+ default:
+ bs, _ := ioutil.ReadAll(resp.Body)
+ return models.UnknownResponse{StatusCode: int64(resp.StatusCode), Body: string(bs)}
+ }
+}
+
func shortHash(s string) string {
return fmt.Sprintf("%x", md5.Sum([]byte(s)))[0:6]
}
diff --git a/samples/gen-go-client-only/client/interface.go b/samples/gen-go-client-only/client/interface.go
index 90f48f4d..27461ff1 100644
--- a/samples/gen-go-client-only/client/interface.go
+++ b/samples/gen-go-client-only/client/interface.go
@@ -83,6 +83,14 @@ type Client interface {
// 500: *models.InternalError
// default: client side HTTP errors, for example: context.DeadlineExceeded.
HealthCheck(ctx context.Context) error
+
+ // LowercaseModelsTest makes a POST request to /lowercaseModelsTest/{pathParam}
+ // testing that we can use a lowercase name for a model
+ // 200: nil
+ // 400: *models.BadRequest
+ // 500: *models.InternalError
+ // default: client side HTTP errors, for example: context.DeadlineExceeded.
+ LowercaseModelsTest(ctx context.Context, i *models.LowercaseModelsTestInput) error
}
// GetAuthorsIter defines the methods available on GetAuthors iterators.
diff --git a/samples/gen-go-client-only/models/inputs.go b/samples/gen-go-client-only/models/inputs.go
index 0aae0bd7..7d240d3b 100644
--- a/samples/gen-go-client-only/models/inputs.go
+++ b/samples/gen-go-client-only/models/inputs.go
@@ -338,3 +338,39 @@ func (i HealthCheckInput) Path() (string, error) {
return path + "?" + urlVals.Encode(), nil
}
+
+// LowercaseModelsTestInput holds the input parameters for a lowercaseModelsTest operation.
+type LowercaseModelsTestInput struct {
+ Lowercase *lowercase
+ PathParam string
+}
+
+// Validate returns an error if any of the LowercaseModelsTestInput parameters don't satisfy the
+// requirements from the swagger yml file.
+func (i LowercaseModelsTestInput) Validate() error {
+
+ if i.Lowercase != nil {
+ if err := i.Lowercase.Validate(nil); err != nil {
+ return err
+ }
+ }
+
+ return nil
+}
+
+// Path returns the URI path for the input.
+func (i LowercaseModelsTestInput) Path() (string, error) {
+ path := "/v1/lowercaseModelsTest/{pathParam}"
+ urlVals := url.Values{}
+
+ pathpathParam := i.PathParam
+ if pathpathParam == "" {
+ err := fmt.Errorf("pathParam cannot be empty because it's a path parameter")
+ if err != nil {
+ return "", err
+ }
+ }
+ path = strings.Replace(path, "{pathParam}", pathpathParam, -1)
+
+ return path + "?" + urlVals.Encode(), nil
+}
diff --git a/samples/gen-go-client-only/models/lowercase.go b/samples/gen-go-client-only/models/lowercase.go
new file mode 100644
index 00000000..c587305f
--- /dev/null
+++ b/samples/gen-go-client-only/models/lowercase.go
@@ -0,0 +1,11 @@
+// Code generated by go-swagger; DO NOT EDIT.
+
+package models
+
+// This file was generated by the swagger tool.
+// Editing this file might prove futile when you re-run the swagger generate command
+
+// Lowercase lowercase
+//
+// swagger:model lowercase
+type Lowercase interface{}
diff --git a/samples/gen-js-client-only/README.md b/samples/gen-js-client-only/README.md
index 72d09fbb..2c0e65c6 100644
--- a/samples/gen-js-client-only/README.md
+++ b/samples/gen-js-client-only/README.md
@@ -20,6 +20,7 @@ swagger-test client library.
* [.getBookByID(params, [options], [cb])](#module_swagger-test--SwaggerTest+getBookByID) ⇒ Promise
* [.getBookByID2(id, [options], [cb])](#module_swagger-test--SwaggerTest+getBookByID2) ⇒ Promise
* [.healthCheck([options], [cb])](#module_swagger-test--SwaggerTest+healthCheck) ⇒ Promise
+ * [.lowercaseModelsTest(params, [options], [cb])](#module_swagger-test--SwaggerTest+lowercaseModelsTest) ⇒ Promise
* _static_
* [.RetryPolicies](#module_swagger-test--SwaggerTest.RetryPolicies)
* [.Exponential](#module_swagger-test--SwaggerTest.RetryPolicies.Exponential)
@@ -300,6 +301,27 @@ Retrieve a book
| [options.retryPolicy] | [RetryPolicies
](#module_swagger-test--SwaggerTest.RetryPolicies) | A request specific retryPolicy |
| [cb] | function
| |
+
+
+#### swaggerTest.lowercaseModelsTest(params, [options], [cb]) ⇒ Promise
+testing that we can use a lowercase name for a model
+
+**Kind**: instance method of [SwaggerTest
](#exp_module_swagger-test--SwaggerTest)
+**Fulfill**: undefined
+**Reject**: [BadRequest
](#module_swagger-test--SwaggerTest.Errors.BadRequest)
+**Reject**: [InternalError
](#module_swagger-test--SwaggerTest.Errors.InternalError)
+**Reject**: Error
+
+| Param | Type | Description |
+| --- | --- | --- |
+| params | Object
| |
+| params.lowercase | | |
+| params.pathParam | string
| |
+| [options] | object
| |
+| [options.timeout] | number
| A request specific timeout |
+| [options.retryPolicy] | [RetryPolicies
](#module_swagger-test--SwaggerTest.RetryPolicies) | A request specific retryPolicy |
+| [cb] | function
| |
+
#### SwaggerTest.RetryPolicies
diff --git a/samples/gen-js-client-only/index.d.ts b/samples/gen-js-client-only/index.d.ts
index c3701770..73d1f406 100644
--- a/samples/gen-js-client-only/index.d.ts
+++ b/samples/gen-js-client-only/index.d.ts
@@ -75,6 +75,8 @@ declare class SwaggerTest {
healthCheck(options?: RequestOptions, cb?: Callback): Promise
+ lowercaseModelsTest(params: models.LowercaseModelsTestParams, options?: RequestOptions, cb?: Callback): Promise
+
}
declare namespace SwaggerTest {
@@ -203,6 +205,11 @@ declare namespace SwaggerTest {
id?: string;
};
+ type LowercaseModelsTestParams = {
+ lowercase: lowercase;
+ pathParam: string;
+};
+
type OmitEmpty = {
arrayFieldNotOmitted?: string[];
arrayFieldOmitted?: string[];
@@ -219,6 +226,10 @@ declare namespace SwaggerTest {
type UnknownResponse = {
body?: string;
statusCode?: number;
+};
+
+ type lowercase = {
+
};
}
diff --git a/samples/gen-js-client-only/index.js b/samples/gen-js-client-only/index.js
index d5ee1b6e..605a85be 100644
--- a/samples/gen-js-client-only/index.js
+++ b/samples/gen-js-client-only/index.js
@@ -1632,6 +1632,116 @@ class SwaggerTest {
}
+ const retryPolicy = options.retryPolicy || this.retryPolicy || singleRetryPolicy;
+ const backoffs = retryPolicy.backoffs();
+ const logger = this.logger;
+
+ let retries = 0;
+ (function requestOnce() {
+ request(requestOptions, (err, response, body) => {
+ if (retries < backoffs.length && retryPolicy.retry(requestOptions, err, response, body)) {
+ const backoff = backoffs[retries];
+ retries += 1;
+ setTimeout(requestOnce, backoff);
+ return;
+ }
+ if (err) {
+ err._fromRequest = true;
+ responseLog(logger, requestOptions, response, err)
+ reject(err);
+ return;
+ }
+
+ switch (response.statusCode) {
+ case 200:
+ resolve();
+ break;
+
+ case 400:
+ var err = new Errors.BadRequest(body || {});
+ responseLog(logger, requestOptions, response, err);
+ reject(err);
+ return;
+
+ case 500:
+ var err = new Errors.InternalError(body || {});
+ responseLog(logger, requestOptions, response, err);
+ reject(err);
+ return;
+
+ default:
+ var err = new Error("Received unexpected statusCode " + response.statusCode);
+ responseLog(logger, requestOptions, response, err);
+ reject(err);
+ return;
+ }
+ });
+ }());
+ });
+ }
+
+ /**
+ * testing that we can use a lowercase name for a model
+ * @param {Object} params
+ * @param params.lowercase
+ * @param {string} params.pathParam
+ * @param {object} [options]
+ * @param {number} [options.timeout] - A request specific timeout
+ * @param {module:swagger-test.RetryPolicies} [options.retryPolicy] - A request specific retryPolicy
+ * @param {function} [cb]
+ * @returns {Promise}
+ * @fulfill {undefined}
+ * @reject {module:swagger-test.Errors.BadRequest}
+ * @reject {module:swagger-test.Errors.InternalError}
+ * @reject {Error}
+ */
+ lowercaseModelsTest(params, options, cb) {
+ let callback = cb;
+ if (!cb && typeof options === "function") {
+ callback = options;
+ }
+ return applyCallback(this._hystrixCommand.execute(this._lowercaseModelsTest, arguments), callback);
+ }
+
+ _lowercaseModelsTest(params, options, cb) {
+ if (!cb && typeof options === "function") {
+ options = undefined;
+ }
+
+ return new Promise((resolve, reject) => {
+ if (!options) {
+ options = {};
+ }
+
+ const timeout = options.timeout || this.timeout;
+
+ const headers = {};
+ headers["Canonical-Resource"] = "lowercaseModelsTest";
+ headers[versionHeader] = version;
+ if (!params.pathParam) {
+ reject(new Error("pathParam must be non-empty because it's a path parameter"));
+ return;
+ }
+
+ const query = {};
+
+ const requestOptions = {
+ method: "POST",
+ uri: this.address + "/v1/lowercaseModelsTest/" + params.pathParam + "",
+ gzip: true,
+ json: true,
+ timeout,
+ headers,
+ qs: query,
+ useQuerystring: true,
+ };
+ if (this.keepalive) {
+ requestOptions.forever = true;
+ }
+
+ requestOptions.body = params.lowercase;
+
+
const retryPolicy = options.retryPolicy || this.retryPolicy || singleRetryPolicy;
const backoffs = retryPolicy.backoffs();
const logger = this.logger;
diff --git a/samples/gen-js/README.md b/samples/gen-js/README.md
index 72d09fbb..2c0e65c6 100644
--- a/samples/gen-js/README.md
+++ b/samples/gen-js/README.md
@@ -20,6 +20,7 @@ swagger-test client library.
* [.getBookByID(params, [options], [cb])](#module_swagger-test--SwaggerTest+getBookByID) ⇒ Promise
* [.getBookByID2(id, [options], [cb])](#module_swagger-test--SwaggerTest+getBookByID2) ⇒ Promise
* [.healthCheck([options], [cb])](#module_swagger-test--SwaggerTest+healthCheck) ⇒ Promise
+ * [.lowercaseModelsTest(params, [options], [cb])](#module_swagger-test--SwaggerTest+lowercaseModelsTest) ⇒ Promise
* _static_
* [.RetryPolicies](#module_swagger-test--SwaggerTest.RetryPolicies)
* [.Exponential](#module_swagger-test--SwaggerTest.RetryPolicies.Exponential)
@@ -300,6 +301,27 @@ Retrieve a book
| [options.retryPolicy] | [RetryPolicies
](#module_swagger-test--SwaggerTest.RetryPolicies) | A request specific retryPolicy |
| [cb] | function
| |
+
+
+#### swaggerTest.lowercaseModelsTest(params, [options], [cb]) ⇒ Promise
+testing that we can use a lowercase name for a model
+
+**Kind**: instance method of [SwaggerTest
](#exp_module_swagger-test--SwaggerTest)
+**Fulfill**: undefined
+**Reject**: [BadRequest
](#module_swagger-test--SwaggerTest.Errors.BadRequest)
+**Reject**: [InternalError
](#module_swagger-test--SwaggerTest.Errors.InternalError)
+**Reject**: Error
+
+| Param | Type | Description |
+| --- | --- | --- |
+| params | Object
| |
+| params.lowercase | | |
+| params.pathParam | string
| |
+| [options] | object
| |
+| [options.timeout] | number
| A request specific timeout |
+| [options.retryPolicy] | [RetryPolicies
](#module_swagger-test--SwaggerTest.RetryPolicies) | A request specific retryPolicy |
+| [cb] | function
| |
+
#### SwaggerTest.RetryPolicies
diff --git a/samples/gen-js/index.d.ts b/samples/gen-js/index.d.ts
index c3701770..73d1f406 100644
--- a/samples/gen-js/index.d.ts
+++ b/samples/gen-js/index.d.ts
@@ -75,6 +75,8 @@ declare class SwaggerTest {
healthCheck(options?: RequestOptions, cb?: Callback): Promise
+ lowercaseModelsTest(params: models.LowercaseModelsTestParams, options?: RequestOptions, cb?: Callback): Promise
+
}
declare namespace SwaggerTest {
@@ -203,6 +205,11 @@ declare namespace SwaggerTest {
id?: string;
};
+ type LowercaseModelsTestParams = {
+ lowercase: lowercase;
+ pathParam: string;
+};
+
type OmitEmpty = {
arrayFieldNotOmitted?: string[];
arrayFieldOmitted?: string[];
@@ -219,6 +226,10 @@ declare namespace SwaggerTest {
type UnknownResponse = {
body?: string;
statusCode?: number;
+};
+
+ type lowercase = {
+
};
}
diff --git a/samples/gen-js/index.js b/samples/gen-js/index.js
index d5ee1b6e..605a85be 100644
--- a/samples/gen-js/index.js
+++ b/samples/gen-js/index.js
@@ -1632,6 +1632,116 @@ class SwaggerTest {
}
+ const retryPolicy = options.retryPolicy || this.retryPolicy || singleRetryPolicy;
+ const backoffs = retryPolicy.backoffs();
+ const logger = this.logger;
+
+ let retries = 0;
+ (function requestOnce() {
+ request(requestOptions, (err, response, body) => {
+ if (retries < backoffs.length && retryPolicy.retry(requestOptions, err, response, body)) {
+ const backoff = backoffs[retries];
+ retries += 1;
+ setTimeout(requestOnce, backoff);
+ return;
+ }
+ if (err) {
+ err._fromRequest = true;
+ responseLog(logger, requestOptions, response, err)
+ reject(err);
+ return;
+ }
+
+ switch (response.statusCode) {
+ case 200:
+ resolve();
+ break;
+
+ case 400:
+ var err = new Errors.BadRequest(body || {});
+ responseLog(logger, requestOptions, response, err);
+ reject(err);
+ return;
+
+ case 500:
+ var err = new Errors.InternalError(body || {});
+ responseLog(logger, requestOptions, response, err);
+ reject(err);
+ return;
+
+ default:
+ var err = new Error("Received unexpected statusCode " + response.statusCode);
+ responseLog(logger, requestOptions, response, err);
+ reject(err);
+ return;
+ }
+ });
+ }());
+ });
+ }
+
+ /**
+ * testing that we can use a lowercase name for a model
+ * @param {Object} params
+ * @param params.lowercase
+ * @param {string} params.pathParam
+ * @param {object} [options]
+ * @param {number} [options.timeout] - A request specific timeout
+ * @param {module:swagger-test.RetryPolicies} [options.retryPolicy] - A request specific retryPolicy
+ * @param {function} [cb]
+ * @returns {Promise}
+ * @fulfill {undefined}
+ * @reject {module:swagger-test.Errors.BadRequest}
+ * @reject {module:swagger-test.Errors.InternalError}
+ * @reject {Error}
+ */
+ lowercaseModelsTest(params, options, cb) {
+ let callback = cb;
+ if (!cb && typeof options === "function") {
+ callback = options;
+ }
+ return applyCallback(this._hystrixCommand.execute(this._lowercaseModelsTest, arguments), callback);
+ }
+
+ _lowercaseModelsTest(params, options, cb) {
+ if (!cb && typeof options === "function") {
+ options = undefined;
+ }
+
+ return new Promise((resolve, reject) => {
+ if (!options) {
+ options = {};
+ }
+
+ const timeout = options.timeout || this.timeout;
+
+ const headers = {};
+ headers["Canonical-Resource"] = "lowercaseModelsTest";
+ headers[versionHeader] = version;
+ if (!params.pathParam) {
+ reject(new Error("pathParam must be non-empty because it's a path parameter"));
+ return;
+ }
+
+ const query = {};
+
+ const requestOptions = {
+ method: "POST",
+ uri: this.address + "/v1/lowercaseModelsTest/" + params.pathParam + "",
+ gzip: true,
+ json: true,
+ timeout,
+ headers,
+ qs: query,
+ useQuerystring: true,
+ };
+ if (this.keepalive) {
+ requestOptions.forever = true;
+ }
+
+ requestOptions.body = params.lowercase;
+
+
const retryPolicy = options.retryPolicy || this.retryPolicy || singleRetryPolicy;
const backoffs = retryPolicy.backoffs();
const logger = this.logger;
diff --git a/samples/swagger.yml b/samples/swagger.yml
index 54ab7953..0beedd13 100644
--- a/samples/swagger.yml
+++ b/samples/swagger.yml
@@ -248,6 +248,24 @@ paths:
schema:
$ref: "#/definitions/AuthorsResponse"
+ /lowercaseModelsTest/{pathParam}:
+ post:
+ operationId: lowercaseModelsTest
+ description: testing that we can use a lowercase name for a model
+ parameters:
+ - name: lowercase
+ in: body
+ required: true
+ schema:
+ $ref: "#/definitions/lowercase"
+ - name: pathParam
+ in: path
+ required: true
+ type: string
+ responses:
+ 200:
+ description: MFAConfig for user
+
definitions:
Book:
type: object
@@ -379,3 +397,6 @@ definitions:
properties:
breed:
type: string
+
+ lowercase:
+ type: object