Skip to content

Commit

Permalink
Make discovery payload nullable in schema (#2638)
Browse files Browse the repository at this point in the history
  • Loading branch information
arbulu89 authored Jun 10, 2024
1 parent 94795c2 commit 24e74e9
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/trento_web/openapi/v1/schema/discovery_event.ex
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ defmodule TrentoWeb.OpenApi.V1.Schema.DiscoveryEvent do
agent_id: %Schema{type: :string, format: :uuid},
discovery_type: %Schema{type: :string},
payload: %Schema{
nullable: true,
oneOf: [%Schema{type: :object}, %Schema{type: :array}]
}
},
Expand Down
12 changes: 12 additions & 0 deletions test/trento_web/controllers/v1/discovery_controller_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,17 @@ defmodule TrentoWeb.V1.DiscoveryControllerTest do
]
} = resp
end

test "collect action should accept nil payloads",
%{conn: conn} do
conn
|> put_req_header("content-type", "application/json")
|> post("/api/v1/collect", %{
"discovery_type" => "ha_cluster_discovery",
"agent_id" => UUID.uuid4(),
"payload" => nil
})
|> json_response(202)
end
end
end

0 comments on commit 24e74e9

Please sign in to comment.