diff --git a/modules/openapi-generator/src/main/resources/go/client.mustache b/modules/openapi-generator/src/main/resources/go/client.mustache index c3af45341201..ec129d3d4323 100644 --- a/modules/openapi-generator/src/main/resources/go/client.mustache +++ b/modules/openapi-generator/src/main/resources/go/client.mustache @@ -169,6 +169,12 @@ func (c *APIClient) ChangeBasePath(path string) { c.cfg.BasePath = path } +// Allow modification of underlying config for alternate implementations and testing +// Caution: modifying the configuration while live can cause data races and potentially unwanted behavior +func (c *APIClient) GetConfig() *Configuration { + return c.cfg +} + // prepareRequest build the request func (c *APIClient) prepareRequest( ctx context.Context, diff --git a/samples/client/petstore/go/go-petstore-withXml/client.go b/samples/client/petstore/go/go-petstore-withXml/client.go index 7791762a544f..73bf022c8886 100644 --- a/samples/client/petstore/go/go-petstore-withXml/client.go +++ b/samples/client/petstore/go/go-petstore-withXml/client.go @@ -181,6 +181,12 @@ func (c *APIClient) ChangeBasePath(path string) { c.cfg.BasePath = path } +// Allow modification of underlying config for alternate implementations and testing +// Caution: modifying the configuration while live can cause data races and potentially unwanted behavior +func (c *APIClient) GetConfig() *Configuration { + return c.cfg +} + // prepareRequest build the request func (c *APIClient) prepareRequest( ctx context.Context, diff --git a/samples/client/petstore/go/go-petstore/client.go b/samples/client/petstore/go/go-petstore/client.go index 30377bdac64c..c73a8db8d093 100644 --- a/samples/client/petstore/go/go-petstore/client.go +++ b/samples/client/petstore/go/go-petstore/client.go @@ -180,6 +180,12 @@ func (c *APIClient) ChangeBasePath(path string) { c.cfg.BasePath = path } +// Allow modification of underlying config for alternate implementations and testing +// Caution: modifying the configuration while live can cause data races and potentially unwanted behavior +func (c *APIClient) GetConfig() *Configuration { + return c.cfg +} + // prepareRequest build the request func (c *APIClient) prepareRequest( ctx context.Context, diff --git a/samples/openapi3/client/petstore/go/go-petstore/client.go b/samples/openapi3/client/petstore/go/go-petstore/client.go index a7ec7b01c64e..afb29fb8c43c 100644 --- a/samples/openapi3/client/petstore/go/go-petstore/client.go +++ b/samples/openapi3/client/petstore/go/go-petstore/client.go @@ -183,6 +183,12 @@ func (c *APIClient) ChangeBasePath(path string) { c.cfg.BasePath = path } +// Allow modification of underlying config for alternate implementations and testing +// Caution: modifying the configuration while live can cause data races and potentially unwanted behavior +func (c *APIClient) GetConfig() *Configuration { + return c.cfg +} + // prepareRequest build the request func (c *APIClient) prepareRequest( ctx context.Context,