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

fix(sdk): use proper annotation for genericError #1611

Merged
merged 1 commit into from
Jul 30, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
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
6 changes: 6 additions & 0 deletions .schema/openapi/patches/generic_error.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
- op: add
path: /paths/~1sessions~1whoami/get/parameters/0/example
value: MP2YWEMeM8MxjkGKpH4dqOQ4Q4DlSPaj
- op: add
path: /paths/~1sessions~1whoami/get/parameters/1/example
value: ory_kratos_session=a19iOVAbdzdgl70Rq1QZmrKmcjDtdsviCTZx7m9a9yHIUS8Wa9T7hvqyGTsLHi6Qifn2WUfpAKx9DWp0SJGleIn9vh2YF4A16id93kXFTgIgmwIOvbVAScyrx7yVl6bPZnCx27ec4WQDtaTewC1CpgudeDV2jQQnSaCP6ny3xa8qLH-QUgYqdQuoA_LF1phxgRCUfIrCLQOkolX5nv3ze_f==
11 changes: 2 additions & 9 deletions .schema/openapi/patches/security.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
- op: replace
path: /components/securitySchemes/oryAccessToken
value:
type: http
scheme: bearer
description: |
This security mechanism is only applicable when using the [Ory Platform](https://console.ory.sh) by
creating an [Ory Personal Access Token](https://www.ory.sh/docs/guides/create-personal-access-token).
If you are using the open source version, this security mechanism
will not work out of the box as you will need to add a security mechanism yourself.
path: /components/schemas/genericError/properties/details/additionalProperties
value: false
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ sdk: .bin/swagger .bin/ory node_modules
-p file://.schema/openapi/patches/security.yaml \
-p file://.schema/openapi/patches/session.yaml \
-p file://.schema/openapi/patches/identity.yaml \
-p file://.schema/openapi/patches/generic_error.yaml \
spec/swagger.json spec/api.json

rm -rf internal/httpclient/models internal/httpclient/clients
Expand Down
11 changes: 4 additions & 7 deletions internal/httpclient/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -216,14 +216,11 @@ Class | Method | HTTP request | Description

### oryAccessToken

- **Type**: HTTP Bearer token authentication
- **Type**: API key
- **API key parameter name**: Authorization
- **Location**: HTTP header

Example

```golang
auth := context.WithValue(context.Background(), sw.ContextAccessToken, "BEARER_TOKEN_STRING")
r, err := client.Service.Operation(auth, args)
```
Note, each API key must be added to a map of `map[string]APIKey` where the key is: Authorization and passed in as the auth context for each request.


## Documentation for Utility Methods
Expand Down
12 changes: 4 additions & 8 deletions internal/httpclient/api/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2660,7 +2660,7 @@ components:
example: SQL field "foo" is not a bool.
type: string
details:
additionalProperties: true
additionalProperties: false
description: Further error details
type: object
message:
Expand Down Expand Up @@ -4595,12 +4595,8 @@ components:
type: object
securitySchemes:
oryAccessToken:
description: |
This security mechanism is only applicable when using the [Ory Platform](https://console.ory.sh) by
creating an [Ory Personal Access Token](https://www.ory.sh/docs/guides/create-personal-access-token).
If you are using the open source version, this security mechanism
will not work out of the box as you will need to add a security mechanism yourself.
scheme: bearer
type: http
in: header
name: Authorization
type: apiKey
x-forwarded-proto: string
x-request-id: string
70 changes: 70 additions & 0 deletions internal/httpclient/api_v0alpha1.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions internal/httpclient/docs/GenericError.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Code** | Pointer to **int64** | The status code | [optional]
**Debug** | Pointer to **string** | Debug information This field is often not exposed to protect against leaking sensitive information. | [optional]
**Details** | Pointer to **map[string]map[string]interface{}** | Further error details | [optional]
**Details** | Pointer to **map[string]interface{}** | Further error details | [optional]
**Message** | **string** | Error message The error's message. |
**Reason** | Pointer to **string** | A human-readable reason for the error | [optional]
**Request** | Pointer to **string** | The request ID The request ID is often exposed internally in order to trace errors across service architectures. This is often a UUID. | [optional]
Expand Down Expand Up @@ -83,20 +83,20 @@ HasDebug returns a boolean if a field has been set.

### GetDetails

`func (o *GenericError) GetDetails() map[string]map[string]interface{}`
`func (o *GenericError) GetDetails() map[string]interface{}`

GetDetails returns the Details field if non-nil, zero value otherwise.

### GetDetailsOk

`func (o *GenericError) GetDetailsOk() (*map[string]map[string]interface{}, bool)`
`func (o *GenericError) GetDetailsOk() (*map[string]interface{}, bool)`

GetDetailsOk returns a tuple with the Details field if it's non-nil, zero value otherwise
and a boolean to check if the value has been set.

### SetDetails

`func (o *GenericError) SetDetails(v map[string]map[string]interface{})`
`func (o *GenericError) SetDetails(v map[string]interface{})`

SetDetails sets Details field to given value.

Expand Down
12 changes: 6 additions & 6 deletions internal/httpclient/model_generic_error.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions spec/api.json
Original file line number Diff line number Diff line change
Expand Up @@ -937,7 +937,7 @@
"type": "string"
},
"details": {
"additionalProperties": true,
"additionalProperties": false,
"description": "Further error details",
"type": "object"
},
Expand Down Expand Up @@ -2129,9 +2129,9 @@
},
"securitySchemes": {
"oryAccessToken": {
"description": "This security mechanism is only applicable when using the [Ory Platform](https://console.ory.sh) by\ncreating an [Ory Personal Access Token](https://www.ory.sh/docs/guides/create-personal-access-token).\nIf you are using the open source version, this security mechanism\nwill not work out of the box as you will need to add a security mechanism yourself.\n",
"scheme": "bearer",
"type": "http"
"in": "header",
"name": "Authorization",
"type": "apiKey"
}
}
},
Expand Down