From 1d934643fdbc15e90caf27fcce603ed4e6cbe028 Mon Sep 17 00:00:00 2001 From: William Cheng Date: Thu, 23 Sep 2021 14:29:33 +0800 Subject: [PATCH] update samples --- samples/client/petstore/javascript-es6/src/ApiClient.js | 9 +++++++-- .../petstore/javascript-promise-es6/src/ApiClient.js | 9 +++++++-- .../haskell-servant/lib/OpenAPIPetstore/Types.hs | 1 + .../petstore/haskell-yesod/src/OpenAPIPetstore/Types.hs | 1 + 4 files changed, 16 insertions(+), 4 deletions(-) diff --git a/samples/client/petstore/javascript-es6/src/ApiClient.js b/samples/client/petstore/javascript-es6/src/ApiClient.js index e21c4712f59..137f64a1cb5 100644 --- a/samples/client/petstore/javascript-es6/src/ApiClient.js +++ b/samples/client/petstore/javascript-es6/src/ApiClient.js @@ -28,13 +28,18 @@ import querystring from "querystring"; * @class */ class ApiClient { - constructor() { + /** + * The base URL against which to resolve every API call's (relative) path. + * Overrides the default value set in spec file if present + * @param {String} basePath + */ + constructor(basePath = 'http://petstore.swagger.io:80/v2') { /** * The base URL against which to resolve every API call's (relative) path. * @type {String} * @default http://petstore.swagger.io:80/v2 */ - this.basePath = 'http://petstore.swagger.io:80/v2'.replace(/\/+$/, ''); + this.basePath = basePath.replace(/\/+$/, ''); /** * The authentication methods to be included for all API calls. diff --git a/samples/client/petstore/javascript-promise-es6/src/ApiClient.js b/samples/client/petstore/javascript-promise-es6/src/ApiClient.js index 49869fffe92..8ca4d9fc8fe 100644 --- a/samples/client/petstore/javascript-promise-es6/src/ApiClient.js +++ b/samples/client/petstore/javascript-promise-es6/src/ApiClient.js @@ -28,13 +28,18 @@ import querystring from "querystring"; * @class */ class ApiClient { - constructor() { + /** + * The base URL against which to resolve every API call's (relative) path. + * Overrides the default value set in spec file if present + * @param {String} basePath + */ + constructor(basePath = 'http://petstore.swagger.io:80/v2') { /** * The base URL against which to resolve every API call's (relative) path. * @type {String} * @default http://petstore.swagger.io:80/v2 */ - this.basePath = 'http://petstore.swagger.io:80/v2'.replace(/\/+$/, ''); + this.basePath = basePath.replace(/\/+$/, ''); /** * The authentication methods to be included for all API calls. diff --git a/samples/server/petstore/haskell-servant/lib/OpenAPIPetstore/Types.hs b/samples/server/petstore/haskell-servant/lib/OpenAPIPetstore/Types.hs index af002e481c9..9bb39c771ab 100644 --- a/samples/server/petstore/haskell-servant/lib/OpenAPIPetstore/Types.hs +++ b/samples/server/petstore/haskell-servant/lib/OpenAPIPetstore/Types.hs @@ -184,6 +184,7 @@ removeFieldLabelPrefix forParsing prefix = , (".", "'Period") , ("/", "'Slash") , (":", "'Colon") + , (";", "'Semicolon") , ("{", "'Left_Curly_Bracket") , ("|", "'Pipe") , ("<", "'LessThan") diff --git a/samples/server/petstore/haskell-yesod/src/OpenAPIPetstore/Types.hs b/samples/server/petstore/haskell-yesod/src/OpenAPIPetstore/Types.hs index 44a78e76afd..1ba7c5d1487 100644 --- a/samples/server/petstore/haskell-yesod/src/OpenAPIPetstore/Types.hs +++ b/samples/server/petstore/haskell-yesod/src/OpenAPIPetstore/Types.hs @@ -154,6 +154,7 @@ removeFieldLabelPrefix forParsing prefix = , (".", "'Period") , ("/", "'Slash") , (":", "'Colon") + , (";", "'Semicolon") , ("{", "'Left_Curly_Bracket") , ("|", "'Pipe") , ("<", "'LessThan")