From 2796985cdf51feb4808e72554fb127048804411b Mon Sep 17 00:00:00 2001 From: John Susek Date: Thu, 27 Sep 2018 13:18:10 -0500 Subject: [PATCH 1/2] Allow optionally passing spec object into init to override it. --- src/gen/js/service.js.template | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/gen/js/service.js.template b/src/gen/js/service.js.template index 2c2c797..c60e3f8 100644 --- a/src/gen/js/service.js.template +++ b/src/gen/js/service.js.template @@ -1,12 +1,14 @@ // Auto-generated, edits will be overwritten -import spec from './spec';; +import specification from './spec';; export class ServiceError extends Error {} let options = {};; +let spec = specification;; -export function init(serviceOptions) { +export function init(serviceOptions, apiSpec = spec) { options = serviceOptions;; + spec = apiSpec;; } export function request(op, parameters, attempt) { From bbd5fe0c28c2442c60c00153edb7a5a207e17f8e Mon Sep 17 00:00:00 2001 From: John Susek Date: Wed, 14 Nov 2018 11:00:54 -0600 Subject: [PATCH 2/2] Update service.ts.template --- src/gen/js/service.ts.template | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/gen/js/service.ts.template b/src/gen/js/service.ts.template index cf8c8ec..fd23255 100644 --- a/src/gen/js/service.ts.template +++ b/src/gen/js/service.ts.template @@ -1,6 +1,6 @@ /// // Auto-generated, edits will be overwritten -import spec from './spec';; +import specification from './spec';; export class ServiceError extends Error implements api.ServiceError { status: number;; @@ -9,9 +9,11 @@ export class ServiceError extends Error implements api.ServiceError { } let options: api.ServiceOptions = {};; +let spec = specification;; -export function init(serviceOptions: api.ServiceOptions) { +export function init(serviceOptions: api.ServiceOptions, apiSpec = spec) { options = serviceOptions;; + spec = apiSpec;; } export function request(op: api.OperationInfo, parameters?: api.OperationParamGroups, attempt = 1): Promise {