[BUG][GO] Replace references to sw package with {{packageName}} in README template (#16812)

* Replace references to sw package with {{packageName}}

* Update samples
This commit is contained in:
Josh Raker 2023-10-14 22:37:27 -04:00 committed by GitHub
parent 8db9af9873
commit c5d6884c63
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 51 additions and 51 deletions

View File

@ -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)
```

View File

@ -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",
})

View File

@ -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",
})

View File

@ -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"},
},
)

View File

@ -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