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

feat: Expose optional field on the recipe configuration #216

Merged
merged 2 commits into from
Jan 25, 2023
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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