-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Using custom values in checks executions (#584)
* Add a SelectedCheck struct represeting a cheeck that has been selected and it's possibly being used during an execution * Expose a function allowing to get selected checks matching a given execution context * Adjust fake server to use selected checks * Use customized values during a checks execution * Adjust checks execution server to use selected checks * Adjust openapi schemas * Address review feedback * Refactor get_current_selection to to_selected_checks
- Loading branch information
1 parent
d47c09e
commit c0f5a5b
Showing
18 changed files
with
653 additions
and
95 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
defmodule Wanda.Catalog.CustomizedValue do | ||
@moduledoc """ | ||
Represents a check's customized value. | ||
""" | ||
|
||
defstruct [:name, :value] | ||
|
||
@type t :: %__MODULE__{ | ||
name: String.t(), | ||
value: boolean() | number() | String.t() | ||
} | ||
|
||
def from_custom_value(%{name: name, value: value}) do | ||
%__MODULE__{ | ||
name: name, | ||
value: value | ||
} | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
defmodule Wanda.Catalog.SelectedCheck do | ||
@moduledoc """ | ||
Represents a selected check used during a check execution. | ||
It carries information about the check specification and its available customizations. | ||
""" | ||
|
||
alias Wanda.Catalog.{Check, CustomizedValue} | ||
|
||
defstruct [ | ||
:id, | ||
:spec, | ||
:customized, | ||
:customizations | ||
] | ||
|
||
@type t :: %__MODULE__{ | ||
id: String.t(), | ||
spec: Check.t(), | ||
customized: boolean(), | ||
customizations: [CustomizedValue.t()] | ||
} | ||
|
||
@spec extract_specs([t]) :: [Check.t()] | ||
def extract_specs(selected_checks), do: Enum.map(selected_checks, & &1.spec) | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.