Skip to content

Change the behavior for Flows::Plugin::DependencyInjector #24

@ddemirkhanyan-vineti

Description

@ddemirkhanyan-vineti

Currently the approach for defining the dependency is not very comfortable when defining a not required dependency.

  dependency :my_dependency,
             default: DefaultDependency,
             type: MyType,
             required: false | true

When the dependency is not required you have to pass a default otherwise it will error out, which proved to be non-optimal when dependencies are so not required there is even no default implementation.

The correct way to handle this seems to be the following:

  • When dependency is required - you have to pass it, if there is no default - it will error out
  • When the dependency is not required - if it's not passed and there is no default just evaluate the variable to nil

That way we can have it more flexible.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions