Skip to content

Commit

Permalink
fix: enum type of session expandables (#3891)
Browse files Browse the repository at this point in the history
  • Loading branch information
jonas-jonas committed Apr 23, 2024
1 parent 9c69ef2 commit 63d785e
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 16 deletions.
6 changes: 3 additions & 3 deletions identity/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -896,18 +896,18 @@ func (h *Handler) patch(w http.ResponseWriter, r *http.Request, ps httprouter.Pa
patchedIdentity.StateChangedAt = &stateChangedAt
}

updatedIdenty := Identity(patchedIdentity)
updatedIdentity := Identity(patchedIdentity)

if err := h.r.IdentityManager().Update(
r.Context(),
&updatedIdenty,
&updatedIdentity,
ManagerAllowWriteProtectedTraits,
); err != nil {
h.r.Writer().WriteError(w, r, err)
return
}

h.r.Writer().Write(w, r, WithCredentialsMetadataAndAdminMetadataInJSON(updatedIdenty))
h.r.Writer().Write(w, r, WithCredentialsMetadataAndAdminMetadataInJSON(updatedIdentity))
}

func deletCredentialWebAuthFromIdentity(identity *Identity) (*Identity, error) {
Expand Down
1 change: 0 additions & 1 deletion package-lock.json

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

12 changes: 10 additions & 2 deletions session/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -338,11 +338,19 @@ type listSessionsRequest struct {
// If no value is provided, the expandable properties are skipped.
//
// required: false
// enum: identity,devices
// in: query
ExpandOptions []string `json:"expand"`
ExpandOptions []ListSessionExpandable `json:"expand"`
}

// Expandable properties of a session
// swagger:enum ListSessionExpandable
type ListSessionExpandable string

const (
ListSessionExpandableIdentity ListSessionExpandable = "identity"
ListSessionExpandableDevices ListSessionExpandable = "devices"
)

// Session List Response
//
// The response given when listing sessions in an administrative context.
Expand Down
8 changes: 4 additions & 4 deletions spec/api.json
Original file line number Diff line number Diff line change
Expand Up @@ -4785,11 +4785,11 @@
"in": "query",
"name": "expand",
"schema": {
"enum": [
"identity",
"devices"
],
"items": {
"enum": [
"identity",
"devices"
],
"type": "string"
},
"type": "array"
Expand Down
12 changes: 6 additions & 6 deletions spec/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -1039,12 +1039,12 @@
"in": "query"
},
{
"enum": [
"identity",
"devices"
],
"type": "array",
"items": {
"enum": [
"identity",
"devices"
],
"type": "string"
},
"description": "ExpandOptions is a query parameter encoded list of all properties that must be expanded in the Session.\nIf no value is provided, the expandable properties are skipped.",
Expand Down Expand Up @@ -3251,9 +3251,9 @@
"title": "JSONRawMessage represents a json.RawMessage that works well with JSON, SQL, and Swagger."
},
"NullTime": {
"description": "NullTime implements the Scanner interface so\nit can be used as a scan destination, similar to NullString.",
"description": "NullTime implements the [Scanner] interface so\nit can be used as a scan destination, similar to [NullString].",
"type": "object",
"title": "NullTime represents a time.Time that may be null.",
"title": "NullTime represents a [time.Time] that may be null.",
"properties": {
"Time": {
"type": "string",
Expand Down

0 comments on commit 63d785e

Please sign in to comment.