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

Openapi schemas no additional properties #2355

Merged
merged 11 commits into from
Feb 22, 2024
1 change: 1 addition & 0 deletions lib/trento_web/openapi/v1/schema/bad_request.ex
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ defmodule TrentoWeb.OpenApi.V1.Schema.BadRequest do
OpenApiSpex.schema(%{
title: "BadRequest",
type: :object,
additionalProperties: false,
properties: %{
errors: %Schema{
type: :array,
Expand Down
3 changes: 3 additions & 0 deletions lib/trento_web/openapi/v1/schema/chart.ex
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ defmodule TrentoWeb.OpenApi.V1.Schema.Chart do
description:
"A Time Series for a chart, has a series of float values distributed through time",
type: :object,
additionalProperties: false,
properties: %{
label: %Schema{type: :string, description: "The name of series"},
series: %Schema{
Expand Down Expand Up @@ -43,6 +44,7 @@ defmodule TrentoWeb.OpenApi.V1.Schema.Chart do

OpenApiSpex.schema(%{
title: "HostCpuChart",
additionalProperties: false,
description: "A Time Series chart with information about the cpu usage of a host",
type: :object,
properties: %{
Expand All @@ -63,6 +65,7 @@ defmodule TrentoWeb.OpenApi.V1.Schema.Chart do
title: "HostMemoryChart",
description: "A Time series chart with information about the memory usage of a host",
type: :object,
additionalProperties: false,
properties: %{
ram_total: ChartTimeSeries,
ram_cache_and_buffer: ChartTimeSeries,
Expand Down
1 change: 1 addition & 0 deletions lib/trento_web/openapi/v1/schema/checks.ex
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ defmodule TrentoWeb.OpenApi.V1.Schema.Checks.ChecksSelectionRequest do
OpenApiSpex.schema(%{
title: "ChecksSelectionRequest",
description: "A list of desired checks that should be executed on the target infrastructure",
additionalProperties: false,
type: :object,
properties: %{
checks: %Schema{
Expand Down
5 changes: 5 additions & 0 deletions lib/trento_web/openapi/v1/schema/checks_catalog.ex
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ defmodule TrentoWeb.OpenApi.V1.Schema.ChecksCatalog do
title: "Check",
description: "An available check to be executed on the target infrastructure",
type: :object,
additionalProperties: false,
properties: %{
id: %Schema{type: :string, description: "Check ID", format: :uuid},
name: %Schema{type: :string, description: "Check Name"},
Expand Down Expand Up @@ -50,6 +51,7 @@ defmodule TrentoWeb.OpenApi.V1.Schema.ChecksCatalog do
OpenApiSpex.schema(%{
title: "ChecksGroup",
description: "A Group of related Checks (Corosync, Pacemaker ...)",
additionalProperties: false,
type: :object,
properties: %{
group: %Schema{type: :string, description: "Group Name"},
Expand All @@ -64,6 +66,7 @@ defmodule TrentoWeb.OpenApi.V1.Schema.ChecksCatalog do
OpenApiSpex.schema(%{
title: "ProviderCatalog",
description: "A Provider specific Catalog, and respective values",
additionalProperties: false,
type: :object,
properties: %{
provider: %Schema{
Expand Down Expand Up @@ -164,6 +167,7 @@ defmodule TrentoWeb.OpenApi.V1.Schema.ChecksCatalog do
OpenApiSpex.schema(%{
title: "CatalogNotfound",
description: "No Catalog was found for the provided query",
additionalProperties: false,
type: :object,
properties: %{
error: %Schema{
Expand All @@ -181,6 +185,7 @@ defmodule TrentoWeb.OpenApi.V1.Schema.ChecksCatalog do
OpenApiSpex.schema(%{
title: "UnableToLoadCatalog",
description: "Something wrong happened while loading the catalog. ie: it is not ready yet",
additionalProperties: false,
type: :object,
properties: %{
error: %Schema{type: :string, description: "The error message"}
Expand Down
5 changes: 5 additions & 0 deletions lib/trento_web/openapi/v1/schema/cluster.ex
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ defmodule TrentoWeb.OpenApi.V1.Schema.Cluster do
title: "ClusterResource",
description: "A Cluster Resource",
type: :object,
additionalProperties: false,
properties: %{
id: %Schema{type: :string},
type: %Schema{type: :string},
Expand All @@ -30,6 +31,7 @@ defmodule TrentoWeb.OpenApi.V1.Schema.Cluster do
OpenApiSpex.schema(%{
title: "HanaClusterNode",
description: "A HANA Cluster Node",
additionalProperties: false,
type: :object,
properties: %{
name: %Schema{type: :string},
Expand All @@ -56,6 +58,7 @@ defmodule TrentoWeb.OpenApi.V1.Schema.Cluster do
OpenApiSpex.schema(%{
title: "SbdDevice",
description: "SBD Device",
additionalProperties: false,
type: :object,
properties: %{
device: %Schema{type: :string},
Expand All @@ -71,6 +74,7 @@ defmodule TrentoWeb.OpenApi.V1.Schema.Cluster do
title: "HanaClusterDetails",
description: "Details of a HANA Pacemaker Cluster",
type: :object,
additionalProperties: false,
properties: %{
system_replication_mode: %Schema{type: :string, description: "System Replication Mode"},
system_replication_operation_mode: %Schema{
Expand Down Expand Up @@ -118,6 +122,7 @@ defmodule TrentoWeb.OpenApi.V1.Schema.Cluster do
title: "PacemakerCluster",
description: "A discovered Pacemaker Cluster on the target infrastructure",
type: :object,
additionalProperties: false,
properties: %{
id: %Schema{type: :string, description: "Cluster ID", format: :uuid},
name: %Schema{type: :string, description: "Cluster name"},
Expand Down
2 changes: 2 additions & 0 deletions lib/trento_web/openapi/v1/schema/database.ex
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ defmodule TrentoWeb.OpenApi.V1.Schema.Database do
title: "DatabaseInstance",
description: "A discovered HANA Database Instance on the target infrastructure",
type: :object,
additionalProperties: false,
properties: %{
sap_system_id: %Schema{type: :string, description: "SAP System ID", format: :uuid},
sid: %Schema{type: :string, description: "SID"},
Expand Down Expand Up @@ -65,6 +66,7 @@ defmodule TrentoWeb.OpenApi.V1.Schema.Database do
title: "Database",
description: "A discovered HANA Database on the target infrastructure",
type: :object,
additionalProperties: false,
properties: %{
id: %Schema{type: :string, description: "Database ID", format: :uuid},
sid: %Schema{type: :string, description: "SID"},
Expand Down
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 @@ -9,6 +9,7 @@ defmodule TrentoWeb.OpenApi.V1.Schema.DiscoveryEvent do
title: "DiscoveryEvent",
description: "A discovery event",
type: :object,
additionalProperties: false,
properties: %{
agent_id: %Schema{type: :string, format: :uuid},
discovery_type: %Schema{type: :string},
Expand Down
1 change: 1 addition & 0 deletions lib/trento_web/openapi/v1/schema/health.ex
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ defmodule TrentoWeb.OpenApi.V1.Schema.Health do
example: %{
database: "pass"
},
additionalProperties: false,
properties: %{
database: %Schema{
description: "The status of the database connection",
Expand Down
10 changes: 9 additions & 1 deletion lib/trento_web/openapi/v1/schema/host.ex
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,13 @@ defmodule TrentoWeb.OpenApi.V1.Schema.Host do
require OpenApiSpex
alias OpenApiSpex.Schema

alias TrentoWeb.OpenApi.V1.Schema.{Provider, SaptuneStatus, SlesSubscription, Tags}
alias TrentoWeb.OpenApi.V1.Schema.{
Provider,
ResourceHealth,
SaptuneStatus,
SlesSubscription,
Tags
}

defmodule IPv4 do
@moduledoc false
Expand Down Expand Up @@ -33,6 +39,7 @@ defmodule TrentoWeb.OpenApi.V1.Schema.Host do
title: "Host",
description: "A discovered host on the target infrastructure",
type: :object,
additionalProperties: false,
properties: %{
id: %Schema{type: :string, description: "Host ID", format: :uuid},
hostname: %Schema{type: :string, description: "Host name"},
Expand All @@ -51,6 +58,7 @@ defmodule TrentoWeb.OpenApi.V1.Schema.Host do
type: :string,
description: "Version of the agent installed on the host"
},
health: ResourceHealth,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick.
Not about this field.
I have checked a bit the code, and the value we could deprecate is the deregistered_at.
It is not used in the frontend anywhere.
So we could remove it in a potential, v2 version.
Anyway, it is not strictly about this PR. Up to you. If you don't do it, it is not a big deal.

cluster_id: %Schema{
type: :string,
description: "Identifier of the cluster this host is part of",
Expand Down
1 change: 1 addition & 0 deletions lib/trento_web/openapi/v1/schema/http_std.ex
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ defmodule TrentoWeb.OpenApi.V1.Schema.HttpStd do
"labelname" => "mylabel"
}
},
additionalProperties: false,
properties: %{
labels: %Schema{
type: :object,
Expand Down
1 change: 1 addition & 0 deletions lib/trento_web/openapi/v1/schema/not_found.ex
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ defmodule TrentoWeb.OpenApi.V1.Schema.NotFound do
OpenApiSpex.schema(%{
title: "NotFound",
type: :object,
additionalProperties: false,
properties: %{
errors: %Schema{
type: :array,
Expand Down
2 changes: 2 additions & 0 deletions lib/trento_web/openapi/v1/schema/platform.ex
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ defmodule TrentoWeb.OpenApi.V1.Schema.Platform do
title: "PlatformSettings",
description: "Settings values for the current installation",
type: :object,
additionalProperties: false,
properties: %{
eula_accepted: %Schema{
type: :boolean,
Expand All @@ -31,6 +32,7 @@ defmodule TrentoWeb.OpenApi.V1.Schema.Platform do
title: "GeneralInformation",
description: "General information about the current installation",
type: :object,
additionalProperties: false,
properties: %{
flavor: %Schema{
type: :string,
Expand Down
3 changes: 3 additions & 0 deletions lib/trento_web/openapi/v1/schema/provider.ex
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ defmodule TrentoWeb.OpenApi.V1.Schema.Provider do
title: "AzureProviderData",
description: "Azure detected metadata",
type: :object,
additionalProperties: false,
properties: %{
resource_group: %Schema{type: :string},
location: %Schema{type: :string},
Expand All @@ -54,6 +55,7 @@ defmodule TrentoWeb.OpenApi.V1.Schema.Provider do
title: "AwsProviderData",
description: "AWS detected metadata",
type: :object,
additionalProperties: false,
properties: %{
account_id: %Schema{type: :string},
ami_id: %Schema{type: :string},
Expand All @@ -74,6 +76,7 @@ defmodule TrentoWeb.OpenApi.V1.Schema.Provider do
title: "GcpProviderData",
description: "GCP detected metadata",
type: :object,
additionalProperties: false,
properties: %{
disk_number: %Schema{type: :integer},
image: %Schema{type: :string},
Expand Down
1 change: 1 addition & 0 deletions lib/trento_web/openapi/v1/schema/ready.ex
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ defmodule TrentoWeb.OpenApi.V1.Schema.Ready do
example: %{
ready: true
},
additionalProperties: false,
properties: %{
ready: %Schema{
description: "Trento Web platform ready",
Expand Down
3 changes: 3 additions & 0 deletions lib/trento_web/openapi/v1/schema/sap_system.ex
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ defmodule TrentoWeb.OpenApi.V1.Schema.SAPSystem do
title: "ApplicationInstance",
description: "A discovered Application Instance on the target infrastructure",
type: :object,
additionalProperties: false,
properties: %{
sap_system_id: %Schema{type: :string, description: "SAP System ID", format: :uuid},
sid: %Schema{type: :string, description: "SID"},
Expand Down Expand Up @@ -49,6 +50,7 @@ defmodule TrentoWeb.OpenApi.V1.Schema.SAPSystem do
title: "SAPSystem",
description: "A discovered SAP System on the target infrastructure",
type: :object,
additionalProperties: false,
properties: %{
id: %Schema{type: :string, description: "SAP System ID", format: :uuid},
sid: %Schema{type: :string, description: "SID"},
Expand Down Expand Up @@ -90,6 +92,7 @@ defmodule TrentoWeb.OpenApi.V1.Schema.SAPSystem do
title: "SAPSystemHealthOverview",
description: "An overview of the health of a discovered SAP System and its components",
type: :object,
additionalProperties: false,
properties: %{
id: %Schema{type: :string, description: "SAP System ID", format: :uuid},
sid: %Schema{type: :string, description: "SID"},
Expand Down
5 changes: 5 additions & 0 deletions lib/trento_web/openapi/v1/schema/saptune_status.ex
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ defmodule TrentoWeb.OpenApi.V1.Schema.SaptuneStatus do
title: "Saptune service",
description: "Saptune service",
type: :object,
additionalProperties: false,
properties: %{
name: %Schema{
type: :string,
Expand All @@ -36,6 +37,7 @@ defmodule TrentoWeb.OpenApi.V1.Schema.SaptuneStatus do
title: "Saptune note",
description: "Saptune note",
type: :object,
additionalProperties: false,
properties: %{
id: %Schema{
type: :string,
Expand All @@ -56,6 +58,7 @@ defmodule TrentoWeb.OpenApi.V1.Schema.SaptuneStatus do
title: "Saptune solution",
description: "Saptune solution",
type: :object,
additionalProperties: false,
properties: %{
id: %Schema{
type: :boolean,
Expand All @@ -81,6 +84,7 @@ defmodule TrentoWeb.OpenApi.V1.Schema.SaptuneStatus do
title: "Saptune staging",
description: "Saptune staging data",
type: :object,
additionalProperties: false,
properties: %{
enabled: %Schema{
type: :boolean,
Expand All @@ -105,6 +109,7 @@ defmodule TrentoWeb.OpenApi.V1.Schema.SaptuneStatus do
description: "Saptune status output on the host",
type: :object,
nullable: true,
additionalProperties: false,
properties: %{
package_version: %Schema{type: :string, description: "Saptune package version"},
configured_version: %Schema{type: :string, description: "Saptune configure version"},
Expand Down
1 change: 1 addition & 0 deletions lib/trento_web/openapi/v1/schema/sles_subscription.ex
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ defmodule TrentoWeb.OpenApi.V1.Schema.SlesSubscription do
title: "SlesSubscription",
description: "A discovered SLES Subscription on a host",
type: :object,
additionalProperties: false,
properties: %{
host_id: %Schema{type: :string, format: :uuid},
identifier: %Schema{type: :string},
Expand Down
3 changes: 3 additions & 0 deletions lib/trento_web/openapi/v1/schema/suma_credentials.ex
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ defmodule TrentoWeb.OpenApi.V1.Schema.SUMACredentials do
title: "SaveSUMACredentialsRequest",
description: "Request body for saving SUMA credentials",
type: :object,
additionalProperties: false,
properties: %{
url: %Schema{
type: :string
Expand Down Expand Up @@ -39,6 +40,7 @@ defmodule TrentoWeb.OpenApi.V1.Schema.SUMACredentials do
"Request body for updating SUMA credentials.\nOnly provide fields to be updated",
type: :object,
minProperties: 1,
additionalProperties: false,
properties: %{
url: %Schema{
type: :string
Expand Down Expand Up @@ -66,6 +68,7 @@ defmodule TrentoWeb.OpenApi.V1.Schema.SUMACredentials do
title: "SUMACredentials",
description: "User settings for SUSE Manager",
type: :object,
additionalProperties: false,
properties: %{
url: %Schema{
type: :string,
Expand Down
1 change: 1 addition & 0 deletions lib/trento_web/openapi/v1/schema/tag.ex
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ defmodule TrentoWeb.OpenApi.V1.Schema.Tags do
title: "Tag",
description: "A tag attached to a resource",
type: :object,
additionalProperties: false,
properties: %{
id: %Schema{type: :integer},
resource_id: %Schema{type: :string, format: :uuid},
Expand Down
1 change: 1 addition & 0 deletions lib/trento_web/openapi/v1/schema/unprocessable_entity.ex
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ defmodule TrentoWeb.OpenApi.V1.Schema.UnprocessableEntity do

OpenApiSpex.schema(%{
type: :object,
additionalProperties: false,
properties: %{
errors: %Schema{
type: :array,
Expand Down
Loading
Loading