From c5d6884c631f3f7b89ecdf0e288fba4c351a898c Mon Sep 17 00:00:00 2001 From: Josh Raker <48493233+joshraker@users.noreply.github.com> Date: Sat, 14 Oct 2023 22:37:27 -0400 Subject: [PATCH] [BUG][GO] Replace references to sw package with {{packageName}} in README template (#16812) * Replace references to sw package with {{packageName}} * Update samples --- .../src/main/resources/go/README.mustache | 28 ++++++++-------- samples/client/echo_api/go/README.md | 8 ++--- .../client/petstore/go/go-petstore/README.md | 20 ++++++------ .../x-auth-id-alias/go-experimental/README.md | 14 ++++---- .../client/petstore/go/go-petstore/README.md | 32 +++++++++---------- 5 files changed, 51 insertions(+), 51 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/go/README.mustache b/modules/openapi-generator/src/main/resources/go/README.mustache index fa3a0adf9e0f..10ea34849165 100644 --- a/modules/openapi-generator/src/main/resources/go/README.mustache +++ b/modules/openapi-generator/src/main/resources/go/README.mustache @@ -47,7 +47,7 @@ Default configuration comes with `Servers` field that contains server objects as ### Select Server Configuration -For using other server than the one defined on index 0 set context value `sw.ContextServerIndex` of type `int`. +For using other server than the one defined on index 0 set context value `{{packageName}}.ContextServerIndex` of type `int`. ```golang ctx := context.WithValue(context.Background(), {{packageName}}.ContextServerIndex, 1) @@ -55,7 +55,7 @@ ctx := context.WithValue(context.Background(), {{packageName}}.ContextServerInde ### Templated Server URL -Templated server URL is formatted using default variables from configuration or from context value `sw.ContextServerVariables` of type `map[string]string`. +Templated server URL is formatted using default variables from configuration or from context value `{{packageName}}.ContextServerVariables` of type `map[string]string`. ```golang ctx := context.WithValue(context.Background(), {{packageName}}.ContextServerVariables, map[string]string{ @@ -69,7 +69,7 @@ Note, enum values are always validated and all unused variables are silently ign Each operation can use different server URL defined using `OperationServers` map in the `Configuration`. An operation is uniquely identified by `"{classname}Service.{nickname}"` string. -Similar rules for overriding default operation server index and variables applies by using `sw.ContextOperationServerIndices` and `sw.ContextOperationServerVariables` context maps. +Similar rules for overriding default operation server index and variables applies by using `{{packageName}}.ContextOperationServerIndices` and `{{packageName}}.ContextOperationServerVariables` context maps. ```golang ctx := context.WithValue(context.Background(), {{packageName}}.ContextOperationServerIndices, map[string]int{ @@ -115,8 +115,8 @@ Example ```golang auth := context.WithValue( context.Background(), - sw.ContextAPIKeys, - map[string]sw.APIKey{ + {{packageName}}.ContextAPIKeys, + map[string]{{packageName}}.APIKey{ "{{keyParamName}}": {Key: "API_KEY_STRING"}, }, ) @@ -131,7 +131,7 @@ r, err := client.Service.Operation(auth, args) Example ```golang -auth := context.WithValue(context.Background(), sw.ContextAccessToken, "BEARER_TOKEN_STRING") +auth := context.WithValue(context.Background(), {{packageName}}.ContextAccessToken, "BEARER_TOKEN_STRING") r, err := client.Service.Operation(auth, args) ``` @@ -142,7 +142,7 @@ r, err := client.Service.Operation(auth, args) Example ```golang -auth := context.WithValue(context.Background(), sw.ContextBasicAuth, sw.BasicAuth{ +auth := context.WithValue(context.Background(), {{packageName}}.ContextBasicAuth, {{packageName}}.BasicAuth{ UserName: "username", Password: "password", }) @@ -156,20 +156,20 @@ r, err := client.Service.Operation(auth, args) Example ```golang - authConfig := client.HttpSignatureAuth{ + authConfig := {{packageName}}.HttpSignatureAuth{ KeyId: "my-key-id", PrivateKeyPath: "rsa.pem", Passphrase: "my-passphrase", - SigningScheme: sw.HttpSigningSchemeHs2019, + SigningScheme: {{packageName}}.HttpSigningSchemeHs2019, SignedHeaders: []string{ - sw.HttpSignatureParameterRequestTarget, // The special (request-target) parameter expresses the HTTP request target. - sw.HttpSignatureParameterCreated, // Time when request was signed, formatted as a Unix timestamp integer value. + {{packageName}}.HttpSignatureParameterRequestTarget, // The special (request-target) parameter expresses the HTTP request target. + {{packageName}}.HttpSignatureParameterCreated, // Time when request was signed, formatted as a Unix timestamp integer value. "Host", // The Host request header specifies the domain name of the server, and optionally the TCP port number. "Date", // The date and time at which the message was originated. "Content-Type", // The Media type of the body of the request. "Digest", // A cryptographic digest of the request body. }, - SigningAlgorithm: sw.HttpSigningAlgorithmRsaPSS, + SigningAlgorithm: {{packageName}}.HttpSigningAlgorithmRsaPSS, SignatureMaxValidity: 5 * time.Minute, } var authCtx context.Context @@ -194,7 +194,7 @@ Example Example ```golang -auth := context.WithValue(context.Background(), sw.ContextAccessToken, "ACCESSTOKENSTRING") +auth := context.WithValue(context.Background(), {{packageName}}.ContextAccessToken, "ACCESSTOKENSTRING") r, err := client.Service.Operation(auth, args) ``` @@ -206,7 +206,7 @@ import "golang.org/x/oauth2" /* Perform OAuth2 round trip request and obtain a token */ tokenSource := oauth2cfg.TokenSource(createContext(httpClient), &token) -auth := context.WithValue(oauth2.NoContext, sw.ContextOAuth2, tokenSource) +auth := context.WithValue(oauth2.NoContext, {{packageName}}.ContextOAuth2, tokenSource) r, err := client.Service.Operation(auth, args) ``` diff --git a/samples/client/echo_api/go/README.md b/samples/client/echo_api/go/README.md index f4b376bc3a82..c79c3ec989f4 100644 --- a/samples/client/echo_api/go/README.md +++ b/samples/client/echo_api/go/README.md @@ -36,7 +36,7 @@ Default configuration comes with `Servers` field that contains server objects as ### Select Server Configuration -For using other server than the one defined on index 0 set context value `sw.ContextServerIndex` of type `int`. +For using other server than the one defined on index 0 set context value `openapi.ContextServerIndex` of type `int`. ```golang ctx := context.WithValue(context.Background(), openapi.ContextServerIndex, 1) @@ -44,7 +44,7 @@ ctx := context.WithValue(context.Background(), openapi.ContextServerIndex, 1) ### Templated Server URL -Templated server URL is formatted using default variables from configuration or from context value `sw.ContextServerVariables` of type `map[string]string`. +Templated server URL is formatted using default variables from configuration or from context value `openapi.ContextServerVariables` of type `map[string]string`. ```golang ctx := context.WithValue(context.Background(), openapi.ContextServerVariables, map[string]string{ @@ -58,7 +58,7 @@ Note, enum values are always validated and all unused variables are silently ign Each operation can use different server URL defined using `OperationServers` map in the `Configuration`. An operation is uniquely identified by `"{classname}Service.{nickname}"` string. -Similar rules for overriding default operation server index and variables applies by using `sw.ContextOperationServerIndices` and `sw.ContextOperationServerVariables` context maps. +Similar rules for overriding default operation server index and variables applies by using `openapi.ContextOperationServerIndices` and `openapi.ContextOperationServerVariables` context maps. ```golang ctx := context.WithValue(context.Background(), openapi.ContextOperationServerIndices, map[string]int{ @@ -125,7 +125,7 @@ Authentication schemes defined for the API: Example ```golang -auth := context.WithValue(context.Background(), sw.ContextBasicAuth, sw.BasicAuth{ +auth := context.WithValue(context.Background(), openapi.ContextBasicAuth, openapi.BasicAuth{ UserName: "username", Password: "password", }) diff --git a/samples/client/petstore/go/go-petstore/README.md b/samples/client/petstore/go/go-petstore/README.md index dffdcd14c5be..2d3e2e0e4c4f 100644 --- a/samples/client/petstore/go/go-petstore/README.md +++ b/samples/client/petstore/go/go-petstore/README.md @@ -37,7 +37,7 @@ Default configuration comes with `Servers` field that contains server objects as ### Select Server Configuration -For using other server than the one defined on index 0 set context value `sw.ContextServerIndex` of type `int`. +For using other server than the one defined on index 0 set context value `petstore.ContextServerIndex` of type `int`. ```golang ctx := context.WithValue(context.Background(), petstore.ContextServerIndex, 1) @@ -45,7 +45,7 @@ ctx := context.WithValue(context.Background(), petstore.ContextServerIndex, 1) ### Templated Server URL -Templated server URL is formatted using default variables from configuration or from context value `sw.ContextServerVariables` of type `map[string]string`. +Templated server URL is formatted using default variables from configuration or from context value `petstore.ContextServerVariables` of type `map[string]string`. ```golang ctx := context.WithValue(context.Background(), petstore.ContextServerVariables, map[string]string{ @@ -59,7 +59,7 @@ Note, enum values are always validated and all unused variables are silently ign Each operation can use different server URL defined using `OperationServers` map in the `Configuration`. An operation is uniquely identified by `"{classname}Service.{nickname}"` string. -Similar rules for overriding default operation server index and variables applies by using `sw.ContextOperationServerIndices` and `sw.ContextOperationServerVariables` context maps. +Similar rules for overriding default operation server index and variables applies by using `petstore.ContextOperationServerIndices` and `petstore.ContextOperationServerVariables` context maps. ```golang ctx := context.WithValue(context.Background(), petstore.ContextOperationServerIndices, map[string]int{ @@ -183,7 +183,7 @@ Authentication schemes defined for the API: Example ```golang -auth := context.WithValue(context.Background(), sw.ContextAccessToken, "ACCESSTOKENSTRING") +auth := context.WithValue(context.Background(), petstore.ContextAccessToken, "ACCESSTOKENSTRING") r, err := client.Service.Operation(auth, args) ``` @@ -195,7 +195,7 @@ import "golang.org/x/oauth2" /* Perform OAuth2 round trip request and obtain a token */ tokenSource := oauth2cfg.TokenSource(createContext(httpClient), &token) -auth := context.WithValue(oauth2.NoContext, sw.ContextOAuth2, tokenSource) +auth := context.WithValue(oauth2.NoContext, petstore.ContextOAuth2, tokenSource) r, err := client.Service.Operation(auth, args) ``` @@ -212,8 +212,8 @@ Example ```golang auth := context.WithValue( context.Background(), - sw.ContextAPIKeys, - map[string]sw.APIKey{ + petstore.ContextAPIKeys, + map[string]petstore.APIKey{ "api_key": {Key: "API_KEY_STRING"}, }, ) @@ -233,8 +233,8 @@ Example ```golang auth := context.WithValue( context.Background(), - sw.ContextAPIKeys, - map[string]sw.APIKey{ + petstore.ContextAPIKeys, + map[string]petstore.APIKey{ "api_key_query": {Key: "API_KEY_STRING"}, }, ) @@ -248,7 +248,7 @@ r, err := client.Service.Operation(auth, args) Example ```golang -auth := context.WithValue(context.Background(), sw.ContextBasicAuth, sw.BasicAuth{ +auth := context.WithValue(context.Background(), petstore.ContextBasicAuth, petstore.BasicAuth{ UserName: "username", Password: "password", }) diff --git a/samples/openapi3/client/extensions/x-auth-id-alias/go-experimental/README.md b/samples/openapi3/client/extensions/x-auth-id-alias/go-experimental/README.md index e92494904b51..eda0b06b0f51 100644 --- a/samples/openapi3/client/extensions/x-auth-id-alias/go-experimental/README.md +++ b/samples/openapi3/client/extensions/x-auth-id-alias/go-experimental/README.md @@ -36,7 +36,7 @@ Default configuration comes with `Servers` field that contains server objects as ### Select Server Configuration -For using other server than the one defined on index 0 set context value `sw.ContextServerIndex` of type `int`. +For using other server than the one defined on index 0 set context value `x_auth_id_alias.ContextServerIndex` of type `int`. ```golang ctx := context.WithValue(context.Background(), x_auth_id_alias.ContextServerIndex, 1) @@ -44,7 +44,7 @@ ctx := context.WithValue(context.Background(), x_auth_id_alias.ContextServerInde ### Templated Server URL -Templated server URL is formatted using default variables from configuration or from context value `sw.ContextServerVariables` of type `map[string]string`. +Templated server URL is formatted using default variables from configuration or from context value `x_auth_id_alias.ContextServerVariables` of type `map[string]string`. ```golang ctx := context.WithValue(context.Background(), x_auth_id_alias.ContextServerVariables, map[string]string{ @@ -58,7 +58,7 @@ Note, enum values are always validated and all unused variables are silently ign Each operation can use different server URL defined using `OperationServers` map in the `Configuration`. An operation is uniquely identified by `"{classname}Service.{nickname}"` string. -Similar rules for overriding default operation server index and variables applies by using `sw.ContextOperationServerIndices` and `sw.ContextOperationServerVariables` context maps. +Similar rules for overriding default operation server index and variables applies by using `x_auth_id_alias.ContextOperationServerIndices` and `x_auth_id_alias.ContextOperationServerVariables` context maps. ```golang ctx := context.WithValue(context.Background(), x_auth_id_alias.ContextOperationServerIndices, map[string]int{ @@ -104,8 +104,8 @@ Example ```golang auth := context.WithValue( context.Background(), - sw.ContextAPIKeys, - map[string]sw.APIKey{ + x_auth_id_alias.ContextAPIKeys, + map[string]x_auth_id_alias.APIKey{ "X-Api-Key": {Key: "API_KEY_STRING"}, }, ) @@ -125,8 +125,8 @@ Example ```golang auth := context.WithValue( context.Background(), - sw.ContextAPIKeys, - map[string]sw.APIKey{ + x_auth_id_alias.ContextAPIKeys, + map[string]x_auth_id_alias.APIKey{ "api_key": {Key: "API_KEY_STRING"}, }, ) diff --git a/samples/openapi3/client/petstore/go/go-petstore/README.md b/samples/openapi3/client/petstore/go/go-petstore/README.md index 262cba3e199a..2906b11b6234 100644 --- a/samples/openapi3/client/petstore/go/go-petstore/README.md +++ b/samples/openapi3/client/petstore/go/go-petstore/README.md @@ -37,7 +37,7 @@ Default configuration comes with `Servers` field that contains server objects as ### Select Server Configuration -For using other server than the one defined on index 0 set context value `sw.ContextServerIndex` of type `int`. +For using other server than the one defined on index 0 set context value `petstore.ContextServerIndex` of type `int`. ```golang ctx := context.WithValue(context.Background(), petstore.ContextServerIndex, 1) @@ -45,7 +45,7 @@ ctx := context.WithValue(context.Background(), petstore.ContextServerIndex, 1) ### Templated Server URL -Templated server URL is formatted using default variables from configuration or from context value `sw.ContextServerVariables` of type `map[string]string`. +Templated server URL is formatted using default variables from configuration or from context value `petstore.ContextServerVariables` of type `map[string]string`. ```golang ctx := context.WithValue(context.Background(), petstore.ContextServerVariables, map[string]string{ @@ -59,7 +59,7 @@ Note, enum values are always validated and all unused variables are silently ign Each operation can use different server URL defined using `OperationServers` map in the `Configuration`. An operation is uniquely identified by `"{classname}Service.{nickname}"` string. -Similar rules for overriding default operation server index and variables applies by using `sw.ContextOperationServerIndices` and `sw.ContextOperationServerVariables` context maps. +Similar rules for overriding default operation server index and variables applies by using `petstore.ContextOperationServerIndices` and `petstore.ContextOperationServerVariables` context maps. ```golang ctx := context.WithValue(context.Background(), petstore.ContextOperationServerIndices, map[string]int{ @@ -206,7 +206,7 @@ Authentication schemes defined for the API: Example ```golang -auth := context.WithValue(context.Background(), sw.ContextAccessToken, "ACCESSTOKENSTRING") +auth := context.WithValue(context.Background(), petstore.ContextAccessToken, "ACCESSTOKENSTRING") r, err := client.Service.Operation(auth, args) ``` @@ -218,7 +218,7 @@ import "golang.org/x/oauth2" /* Perform OAuth2 round trip request and obtain a token */ tokenSource := oauth2cfg.TokenSource(createContext(httpClient), &token) -auth := context.WithValue(oauth2.NoContext, sw.ContextOAuth2, tokenSource) +auth := context.WithValue(oauth2.NoContext, petstore.ContextOAuth2, tokenSource) r, err := client.Service.Operation(auth, args) ``` @@ -235,8 +235,8 @@ Example ```golang auth := context.WithValue( context.Background(), - sw.ContextAPIKeys, - map[string]sw.APIKey{ + petstore.ContextAPIKeys, + map[string]petstore.APIKey{ "api_key": {Key: "API_KEY_STRING"}, }, ) @@ -256,8 +256,8 @@ Example ```golang auth := context.WithValue( context.Background(), - sw.ContextAPIKeys, - map[string]sw.APIKey{ + petstore.ContextAPIKeys, + map[string]petstore.APIKey{ "api_key_query": {Key: "API_KEY_STRING"}, }, ) @@ -271,7 +271,7 @@ r, err := client.Service.Operation(auth, args) Example ```golang -auth := context.WithValue(context.Background(), sw.ContextBasicAuth, sw.BasicAuth{ +auth := context.WithValue(context.Background(), petstore.ContextBasicAuth, petstore.BasicAuth{ UserName: "username", Password: "password", }) @@ -285,7 +285,7 @@ r, err := client.Service.Operation(auth, args) Example ```golang -auth := context.WithValue(context.Background(), sw.ContextAccessToken, "BEARER_TOKEN_STRING") +auth := context.WithValue(context.Background(), petstore.ContextAccessToken, "BEARER_TOKEN_STRING") r, err := client.Service.Operation(auth, args) ``` @@ -296,20 +296,20 @@ r, err := client.Service.Operation(auth, args) Example ```golang - authConfig := client.HttpSignatureAuth{ + authConfig := petstore.HttpSignatureAuth{ KeyId: "my-key-id", PrivateKeyPath: "rsa.pem", Passphrase: "my-passphrase", - SigningScheme: sw.HttpSigningSchemeHs2019, + SigningScheme: petstore.HttpSigningSchemeHs2019, SignedHeaders: []string{ - sw.HttpSignatureParameterRequestTarget, // The special (request-target) parameter expresses the HTTP request target. - sw.HttpSignatureParameterCreated, // Time when request was signed, formatted as a Unix timestamp integer value. + petstore.HttpSignatureParameterRequestTarget, // The special (request-target) parameter expresses the HTTP request target. + petstore.HttpSignatureParameterCreated, // Time when request was signed, formatted as a Unix timestamp integer value. "Host", // The Host request header specifies the domain name of the server, and optionally the TCP port number. "Date", // The date and time at which the message was originated. "Content-Type", // The Media type of the body of the request. "Digest", // A cryptographic digest of the request body. }, - SigningAlgorithm: sw.HttpSigningAlgorithmRsaPSS, + SigningAlgorithm: petstore.HttpSigningAlgorithmRsaPSS, SignatureMaxValidity: 5 * time.Minute, } var authCtx context.Context