Skip to content

Commit

Permalink
Rename WithImplementations() to WithRuntimeValues().
Browse files Browse the repository at this point in the history
  • Loading branch information
jmalloc committed Oct 15, 2024
1 parent 7fff15c commit 0479923
Show file tree
Hide file tree
Showing 9 changed files with 16 additions and 16 deletions.
4 changes: 2 additions & 2 deletions config/aggregate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -292,13 +292,13 @@ func TestAggregate_validation(t *testing.T) {
},
},
{
Name: "missing implementations using WithImplementations() option",
Name: "missing implementations using WithRuntimeValues() option",
Expect: `aggregate:github.com/dogmatiq/enginekit/enginetest/stubs.AggregateMessageHandlerStub is invalid:` +
"\n" + `- missing implementation: dogma.AggregateMessageHandler value is not available` +
"\n" + `- handles-command(github.com/dogmatiq/enginekit/enginetest/stubs.CommandStub[github.com/dogmatiq/enginekit/enginetest/stubs.TypeA]) is invalid: missing implementation: message.Type value is not available` +
"\n" + `- records-event(github.com/dogmatiq/enginekit/enginetest/stubs.EventStub[github.com/dogmatiq/enginekit/enginetest/stubs.TypeA]) is invalid: missing implementation: message.Type value is not available`,
Options: []NormalizeOption{
WithImplementations(),
WithRuntimeValues(),
},
Component: &Aggregate{
AsConfigured: AggregateAsConfigured{
Expand Down
4 changes: 2 additions & 2 deletions config/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -279,12 +279,12 @@ func TestIntegration_validation(t *testing.T) {
},
},
{
Name: "missing implementations using WithImplementations() option",
Name: "missing implementations using WithRuntimeValues() option",
Expect: `integration:github.com/dogmatiq/enginekit/enginetest/stubs.IntegrationMessageHandlerStub is invalid:` +
"\n" + `- missing implementation: dogma.IntegrationMessageHandler value is not available` +
"\n" + `- handles-command(github.com/dogmatiq/enginekit/enginetest/stubs.CommandStub[github.com/dogmatiq/enginekit/enginetest/stubs.TypeA]) is invalid: missing implementation: message.Type value is not available`,
Options: []NormalizeOption{
WithImplementations(),
WithRuntimeValues(),
},
Component: &Integration{
AsConfigured: IntegrationAsConfigured{
Expand Down
4 changes: 2 additions & 2 deletions config/normalize.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ func newFinalizeContext(c Component) *normalizeContext {

// normalizeOptions is the result of applying a set of [NormalizeOption] values.
type normalizeOptions struct {
PanicOnFailure bool
RequireImplementations bool
PanicOnFailure bool
RequireValues bool
}

func (c *normalizeContext) NewChild(com Component) *normalizeContext {
Expand Down
6 changes: 3 additions & 3 deletions config/normalizeoption.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ package config
// [MustNormalize].
type NormalizeOption func(*normalizeOptions)

// WithImplementations is a [NormalizeOption] that requires all application,
// WithRuntimeValues is a [NormalizeOption] that requires all application,
// handler and message implementations to be available in order to consider the
// configuration valid.
func WithImplementations() NormalizeOption {
func WithRuntimeValues() NormalizeOption {
return func(o *normalizeOptions) {
o.RequireImplementations = true
o.RequireValues = true
}
}
4 changes: 2 additions & 2 deletions config/process_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -285,13 +285,13 @@ func TestProcess_validation(t *testing.T) {
},
},
{
Name: "missing implementations using WithImplementations() option",
Name: "missing implementations using WithRuntimeValues() option",
Expect: `process:github.com/dogmatiq/enginekit/enginetest/stubs.ProcessMessageHandlerStub is invalid:` +
"\n" + `- missing implementation: dogma.ProcessMessageHandler value is not available` +
"\n" + `- handles-event(github.com/dogmatiq/enginekit/enginetest/stubs.EventStub[github.com/dogmatiq/enginekit/enginetest/stubs.TypeA]) is invalid: missing implementation: message.Type value is not available` +
"\n" + `- executes-command(github.com/dogmatiq/enginekit/enginetest/stubs.CommandStub[github.com/dogmatiq/enginekit/enginetest/stubs.TypeA]) is invalid: missing implementation: message.Type value is not available`,
Options: []NormalizeOption{
WithImplementations(),
WithRuntimeValues(),
},
Component: &Process{
AsConfigured: ProcessAsConfigured{
Expand Down
4 changes: 2 additions & 2 deletions config/projection_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -290,13 +290,13 @@ func TestProjection_validation(t *testing.T) {
},
},
{
Name: "missing implementations using WithImplementations() option",
Name: "missing implementations using WithRuntimeValues() option",
Expect: `projection:github.com/dogmatiq/enginekit/enginetest/stubs.ProjectionMessageHandlerStub is invalid:` +
"\n" + `- missing implementation: dogma.ProjectionMessageHandler value is not available` +
"\n" + `- missing implementation: dogma.ProjectionDeliveryPolicy value is not available` +
"\n" + `- handles-event(github.com/dogmatiq/enginekit/enginetest/stubs.EventStub[github.com/dogmatiq/enginekit/enginetest/stubs.TypeA]) is invalid: missing implementation: message.Type value is not available`,
Options: []NormalizeOption{
WithImplementations(),
WithRuntimeValues(),
},
Component: &Projection{
AsConfigured: ProjectionAsConfigured{
Expand Down
2 changes: 1 addition & 1 deletion config/route.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ func (r Route) normalize(ctx *normalizeContext) Component {
}

r.AsConfigured.MessageTypeName = optional.Some(actualTypeName)
} else if ctx.Options.RequireImplementations {
} else if ctx.Options.RequireValues {
ctx.Fail(ImplementationUnavailableError{reflect.TypeFor[message.Type]()})
}

Expand Down
2 changes: 1 addition & 1 deletion config/value.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func normalizeValue[T any](
}

inner.TypeName = optional.Some(actualTypeName)
} else if ctx.Options.RequireImplementations {
} else if ctx.Options.RequireValues {
ctx.Fail(ImplementationUnavailableError{reflect.TypeFor[T]()})
}

Expand Down
2 changes: 1 addition & 1 deletion config/value_error.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (

// ImplementationUnavailableError indicates that a [Value] is invalid
// because it does not contain some runtime value or type information and the
// [WithImplementations] option was specified during normalization.
// [WithRuntimeValues] option was specified during normalization.
type ImplementationUnavailableError struct {
MissingType reflect.Type
}
Expand Down

0 comments on commit 0479923

Please sign in to comment.