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: mark flow methods' fields as required #708

Merged
merged 1 commit into from
Oct 1, 2020
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 16 additions & 0 deletions .schema/api.swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -2210,6 +2210,10 @@
},
"recoveryFlowMethod": {
"type": "object",
"required": [
"method",
"config"
],
"properties": {
"config": {
"$ref": "#/definitions/recoveryFlowMethodConfig"
Expand Down Expand Up @@ -2308,6 +2312,10 @@
},
"registrationFlowMethod": {
"type": "object",
"required": [
"method",
"config"
],
"properties": {
"config": {
"$ref": "#/definitions/registrationFlowMethodConfig"
Expand Down Expand Up @@ -2471,6 +2479,10 @@
},
"settingsFlowMethod": {
"type": "object",
"required": [
"method",
"config"
],
"properties": {
"config": {
"$ref": "#/definitions/FlowMethodConfig"
Expand Down Expand Up @@ -2547,6 +2559,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