Skip to content

Commit

Permalink
feat: Expose optional field on the recipe configuration (#216)
Browse files Browse the repository at this point in the history
  • Loading branch information
floreks authored Jan 25, 2023
1 parent b39d265 commit 841afbd
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
1 change: 1 addition & 0 deletions lib/console/graphql/plural.ex
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ defmodule Console.GraphQl.Plural do
field :placeholder, :string
field :documentation, :string
field :default, :string
field :optional, :boolean
field :condition, :configuration_condition
field :validation, :configuration_validation
end
Expand Down
2 changes: 1 addition & 1 deletion lib/console/plural/models.ex
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ end

defmodule Console.Plural.ConfigurationItem do
alias Console.Plural.{Condition, Validation}
defstruct [:name, :default, :documentation, :type, :placeholder, :condition, :validation]
defstruct [:name, :default, :documentation, :type, :placeholder, :condition, :validation, :optional]

def spec() do
%__MODULE__{
Expand Down
5 changes: 3 additions & 2 deletions test/console/graphql/queries/plural_queries_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ defmodule Console.GraphQl.PluralQueriesTest do
recipeItems: [
%{
id: "id4",
configuration: [%{name: "name", documentation: "some documentation", type: "STRING"}]
configuration: [%{name: "name", documentation: "some documentation", type: "STRING", optional: true}]
}
]
}
Expand All @@ -150,7 +150,7 @@ defmodule Console.GraphQl.PluralQueriesTest do
repository { id }
recipeItems {
id
configuration { name documentation type }
configuration { name documentation type optional }
}
}
}
Expand All @@ -171,6 +171,7 @@ defmodule Console.GraphQl.PluralQueriesTest do
assert hd(item["configuration"])["name"] == "name"
assert hd(item["configuration"])["documentation"] == "some documentation"
assert hd(item["configuration"])["type"] == "STRING"
assert hd(item["configuration"])["optional"]
end

test "it will set oidc enabled correctly" do
Expand Down

0 comments on commit 841afbd

Please sign in to comment.