Skip to content

Commit

Permalink
fix: mark flow methods' fields as required (#708)
Browse files Browse the repository at this point in the history
  • Loading branch information
aeneasr authored Oct 1, 2020
1 parent ce9cb9f commit 834c607
Show file tree
Hide file tree
Showing 10 changed files with 100 additions and 21 deletions.
16 changes: 16 additions & 0 deletions .schema/api.swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -2225,6 +2225,10 @@
},
"recoveryFlowMethod": {
"type": "object",
"required": [
"method",
"config"
],
"properties": {
"config": {
"$ref": "#/definitions/recoveryFlowMethodConfig"
Expand Down Expand Up @@ -2323,6 +2327,10 @@
},
"registrationFlowMethod": {
"type": "object",
"required": [
"method",
"config"
],
"properties": {
"config": {
"$ref": "#/definitions/registrationFlowMethodConfig"
Expand Down Expand Up @@ -2486,6 +2494,10 @@
},
"settingsFlowMethod": {
"type": "object",
"required": [
"method",
"config"
],
"properties": {
"config": {
"$ref": "#/definitions/FlowMethodConfig"
Expand Down Expand Up @@ -2562,6 +2574,10 @@
},
"verificationFlowMethod": {
"type": "object",
"required": [
"method",
"config"
],
"properties": {
"config": {
"$ref": "#/definitions/verificationFlowMethodConfig"
Expand Down
24 changes: 20 additions & 4 deletions internal/httpclient/models/recovery_flow_method.go

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

15 changes: 7 additions & 8 deletions internal/httpclient/models/registration_flow_method.go

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

24 changes: 20 additions & 4 deletions internal/httpclient/models/settings_flow_method.go

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

24 changes: 20 additions & 4 deletions internal/httpclient/models/verification_flow_method.go

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

4 changes: 4 additions & 0 deletions selfservice/flow/recovery/flow_method.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,13 @@ import (
// swagger:model recoveryFlowMethod
type FlowMethod struct {
// Method contains the request credentials type.
//
// required: true
Method string `json:"method" db:"method"`

// Config is the credential type's config.
//
// required: true
Config *FlowMethodConfig `json:"config" db:"config"`

// ID is a helper struct field for gobuffalo.pop.
Expand Down
4 changes: 4 additions & 0 deletions selfservice/flow/registration/flow_method.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,13 @@ import (
// swagger:model registrationFlowMethod
type FlowMethod struct {
// Method contains the flow method's credentials type.
//
// required: true
Method identity.CredentialsType `json:"method" faker:"string" db:"method"`

// Config is the credential type's config.
//
// required: true
Config *FlowMethodConfig `json:"config" db:"config"`

// ID is a helper struct field for gobuffalo.pop.
Expand Down
4 changes: 4 additions & 0 deletions selfservice/flow/settings/flow_method.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,13 @@ import (
// swagger:model settingsFlowMethod
type FlowMethod struct {
// Method is the name of this flow method.
//
// required: true
Method string `json:"method" db:"method"`

// Config is the credential type's config.
//
// required: true
Config *FlowMethodConfig `json:"config" db:"config"`

// ID is a helper struct field for gobuffalo.pop.
Expand Down
4 changes: 4 additions & 0 deletions selfservice/flow/verification/flow_method.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,13 @@ import (
// swagger:model verificationFlowMethod
type FlowMethod struct {
// Method contains the request credentials type.
//
// required: true
Method string `json:"method" db:"method"`

// Config is the credential type's config.
//
// required: true
Config *FlowMethodConfig `json:"config" db:"config"`

// ID is a helper struct field for gobuffalo.pop.
Expand Down
2 changes: 1 addition & 1 deletion selfservice/strategy/oidc/strategy_settings_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ func TestSettingsStrategy(t *testing.T) {
assert.EqualValues(t, req.IssuedAt, time.Time(*rs.Payload.IssuedAt))

require.NotNil(t, identity.CredentialsTypeOIDC.String(), rs.Payload.Methods[identity.CredentialsTypeOIDC.String()])
require.EqualValues(t, identity.CredentialsTypeOIDC.String(), rs.Payload.Methods[identity.CredentialsTypeOIDC.String()].Method)
require.EqualValues(t, identity.CredentialsTypeOIDC.String(), *rs.Payload.Methods[identity.CredentialsTypeOIDC.String()].Method)
require.EqualValues(t, publicTS.URL+oidc.SettingsPath+"?flow="+req.ID.String(),
*rs.Payload.Methods[identity.CredentialsTypeOIDC.String()].Config.Action)
})
Expand Down

0 comments on commit 834c607

Please sign in to comment.