Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: bump openapi-generator #3696

Merged
merged 5 commits into from
Jan 22, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,10 @@ sdk: .bin/swagger .bin/ory node_modules
-g go \
-o "internal/httpclient" \
--git-user-id ory \
--git-repo-id hydra-client-go \
--git-host github.com
(cd internal/httpclient && go mod edit -module github.com/ory/hydra-client-go/v2)
--git-repo-id hydra-client-go/v2 \
--git-host github.com \
--api-name-suffix "Api" \
--global-property apiTests=false

make format

Expand Down
2 changes: 1 addition & 1 deletion internal/httpclient/.openapi-generator/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
6.0.1
7.2.0
44 changes: 21 additions & 23 deletions internal/httpclient/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,21 @@ This API client was generated by the [OpenAPI Generator](https://openapi-generat

Install the following dependencies:

```shell
```sh
go get github.com/stretchr/testify/assert
go get golang.org/x/oauth2
go get golang.org/x/net/context
```

Put the package under your project folder and add the following in import:

```golang
import openapi "github.com/ory/hydra-client-go"
```go
import openapi "github.com/ory/hydra-client-go/v2"
```

To use a proxy, set the environment variable `HTTP_PROXY`:

```golang
```go
os.Setenv("HTTP_PROXY", "http://proxy_name:proxy_port")
```

Expand All @@ -38,17 +38,17 @@ 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
```go
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
```go
ctx := context.WithValue(context.Background(), openapi.ContextServerVariables, map[string]string{
"basePath": "v2",
})
Expand All @@ -60,9 +60,9 @@ 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.

```
```go
ctx := context.WithValue(context.Background(), openapi.ContextOperationServerIndices, map[string]int{
"{classname}Service.{nickname}": 2,
})
Expand Down Expand Up @@ -179,34 +179,32 @@ Class | Method | HTTP request | Description
## Documentation For Authorization



Authentication schemes defined for the API:
### basic

- **Type**: HTTP basic authentication

Example

```golang
auth := context.WithValue(context.Background(), sw.ContextBasicAuth, sw.BasicAuth{
UserName: "username",
Password: "password",
```go
auth := context.WithValue(context.Background(), openapi.ContextBasicAuth, openapi.BasicAuth{
UserName: "username",
Password: "password",
})
r, err := client.Service.Operation(auth, args)
```


### bearer

- **Type**: HTTP Bearer token authentication

Example

```golang
auth := context.WithValue(context.Background(), sw.ContextAccessToken, "BEARER_TOKEN_STRING")
```go
auth := context.WithValue(context.Background(), openapi.ContextAccessToken, "BEARER_TOKEN_STRING")
r, err := client.Service.Operation(auth, args)
```


### oauth2


Expand All @@ -220,20 +218,20 @@ r, err := client.Service.Operation(auth, args)

Example

```golang
auth := context.WithValue(context.Background(), sw.ContextAccessToken, "ACCESSTOKENSTRING")
```go
auth := context.WithValue(context.Background(), openapi.ContextAccessToken, "ACCESSTOKENSTRING")
r, err := client.Service.Operation(auth, args)
```

Or via OAuth2 module to automatically refresh tokens and perform user authentication.

```golang
```go
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, openapi.ContextOAuth2, tokenSource)
r, err := client.Service.Operation(auth, args)
```

Expand Down
Loading
Loading