Skip to content

Commit

Permalink
Polish Host OpenApi schema
Browse files Browse the repository at this point in the history
  • Loading branch information
nelsonkopliku committed May 11, 2022
1 parent abb66c1 commit deb9da3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
2 changes: 1 addition & 1 deletion lib/trento_web/controllers/host_controller.ex
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ defmodule TrentoWeb.HostController do
responses: [
ok:
{"A collection of the discovered hosts", "application/json",
TrentoWeb.OpenApi.Schema.Host.Collection}
TrentoWeb.OpenApi.Schema.Host.HostsCollection}
]

@spec list(Plug.Conn.t(), map) :: Plug.Conn.t()
Expand Down
8 changes: 3 additions & 5 deletions lib/trento_web/openapi/schema/host.ex
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ defmodule TrentoWeb.OpenApi.Schema.Host do
})
end

defmodule Item do
defmodule HostItem do
@moduledoc false

OpenApiSpex.schema(%{
Expand All @@ -33,7 +33,6 @@ defmodule TrentoWeb.OpenApi.Schema.Host do
type: :object,
properties: %{
id: %Schema{type: :integer, description: "Host ID"},
# pattern: ~r/[a-zA-Z][a-zA-Z0-9_]+/
hostname: %Schema{type: :string, description: "Host name"},
ip_addresses: %Schema{
type: :array,
Expand Down Expand Up @@ -80,18 +79,17 @@ defmodule TrentoWeb.OpenApi.Schema.Host do
items: TrentoWeb.OpenApi.Schema.SlesSubscription
}
}
# required: [:name, :email],
})
end

defmodule Collection do
defmodule HostsCollection do
@moduledoc false

OpenApiSpex.schema(%{
title: "HostsCollection",
description: "A list of the discovered hosts",
type: :array,
items: Item
items: HostItem
})
end
end

0 comments on commit deb9da3

Please sign in to comment.