Skip to content

Open source, privacy-first web analytics. Lightweight, cookie-free Google Analytics alternative. Self-hosted or cloud.

Tidy up openapi schema (#3498)

hq138b1834b3f2b
diff --git a/lib/plausible_web/plugins/api/schemas/error.ex b/lib/plausible_web/plugins/api/schemas/error.ex
index 2285f1e8e4..6804ef3ff7 100644
--- a/lib/plausible_web/plugins/api/schemas/error.ex
+++ b/lib/plausible_web/plugins/api/schemas/error.ex
@@ -11,6 +11,6 @@ defmodule PlausibleWeb.Plugins.API.Schemas.Error do
""",
type: :object,
required: [:detail],
- properties: %{detail: %OpenApiSpex.Schema{type: :string}}
+ properties: %{detail: %Schema{type: :string}}
})
end
diff --git a/lib/plausible_web/plugins/api/schemas/goal/list_response.ex b/lib/plausible_web/plugins/api/schemas/goal/list_response.ex
index b458d64d30..4d5f433c41 100644
--- a/lib/plausible_web/plugins/api/schemas/goal/list_response.ex
+++ b/lib/plausible_web/plugins/api/schemas/goal/list_response.ex
@@ -14,15 +14,12 @@ defmodule PlausibleWeb.Plugins.API.Schemas.Goal.ListResponse do
items: Schemas.Goal,
type: :array
},
- meta: %OpenApiSpex.Schema{
+ meta: %Schema{
required: [:pagination],
- properties: %{
- pagination: %OpenApiSpex.Reference{
- "$ref": "#/components/schemas/PaginationMetadata"
- }
- },
type: :object,
- items: Schemas.PaginationMetadata
+ properties: %{
+ pagination: Schemas.PaginationMetadata
+ }
}
}
})
diff --git a/lib/plausible_web/plugins/api/schemas/link.ex b/lib/plausible_web/plugins/api/schemas/link.ex
index 676687eadd..7082b51284 100644
--- a/lib/plausible_web/plugins/api/schemas/link.ex
+++ b/lib/plausible_web/plugins/api/schemas/link.ex
@@ -8,6 +8,6 @@ defmodule PlausibleWeb.Plugins.API.Schemas.Link do
title: "Link",
type: :object,
required: [:url],
- properties: %{url: %OpenApiSpex.Schema{type: :string}}
+ properties: %{url: %Schema{type: :string}}
})
end
diff --git a/lib/plausible_web/plugins/api/schemas/not_found.ex b/lib/plausible_web/plugins/api/schemas/not_found.ex
index 7d0efd7234..0cb8ffcc27 100644
--- a/lib/plausible_web/plugins/api/schemas/not_found.ex
+++ b/lib/plausible_web/plugins/api/schemas/not_found.ex
@@ -13,7 +13,7 @@ defmodule PlausibleWeb.Plugins.API.Schemas.NotFound do
title: "NotFoundError",
required: [:errors],
properties: %{
- errors: %OpenApiSpex.Schema{
+ errors: %Schema{
items: Schemas.Error,
type: :array
}
diff --git a/lib/plausible_web/plugins/api/schemas/pagination_metadata.ex b/lib/plausible_web/plugins/api/schemas/pagination_metadata.ex
index 00a3651e79..7df4a1b288 100644
--- a/lib/plausible_web/plugins/api/schemas/pagination_metadata.ex
+++ b/lib/plausible_web/plugins/api/schemas/pagination_metadata.ex
@@ -10,13 +10,12 @@ defmodule PlausibleWeb.Plugins.API.Schemas.PaginationMetadata do
type: :object,
required: [:has_next_page, :has_prev_page],
properties: %{
- has_next_page: %OpenApiSpex.Schema{type: :boolean},
- has_prev_page: %OpenApiSpex.Schema{type: :boolean},
- links: %OpenApiSpex.Schema{
- items: Schemas.Link,
+ has_next_page: %Schema{type: :boolean},
+ has_prev_page: %Schema{type: :boolean},
+ links: %Schema{
properties: %{
- next: %OpenApiSpex.Reference{"$ref": "#/components/schemas/Link"},
- prev: %OpenApiSpex.Reference{"$ref": "#/components/schemas/Link"}
+ next: Schemas.Link,
+ prev: Schemas.Link
},
type: :object
}
diff --git a/lib/plausible_web/plugins/api/schemas/payment_required.ex b/lib/plausible_web/plugins/api/schemas/payment_required.ex
index ab22e69527..6eb5ee2ce0 100644
--- a/lib/plausible_web/plugins/api/schemas/payment_required.ex
+++ b/lib/plausible_web/plugins/api/schemas/payment_required.ex
@@ -14,7 +14,7 @@ defmodule PlausibleWeb.Plugins.API.Schemas.PaymentRequired do
title: "PaymentRequiredError",
required: [:errors],
properties: %{
- errors: %OpenApiSpex.Schema{
+ errors: %Schema{
items: Schemas.Error,
type: :array
}
diff --git a/lib/plausible_web/plugins/api/schemas/shared_link/list_response.ex b/lib/plausible_web/plugins/api/schemas/shared_link/list_response.ex
index 87464c4638..575fa98609 100644
--- a/lib/plausible_web/plugins/api/schemas/shared_link/list_response.ex
+++ b/lib/plausible_web/plugins/api/schemas/shared_link/list_response.ex
@@ -14,15 +14,12 @@ defmodule PlausibleWeb.Plugins.API.Schemas.SharedLink.ListResponse do
items: Schemas.SharedLink,
type: :array
},
- meta: %OpenApiSpex.Schema{
+ meta: %Schema{
required: [:pagination],
- properties: %{
- pagination: %OpenApiSpex.Reference{
- "$ref": "#/components/schemas/PaginationMetadata"
- }
- },
type: :object,
- items: Schemas.PaginationMetadata
+ properties: %{
+ pagination: Schemas.PaginationMetadata
+ }
}
}
})
diff --git a/lib/plausible_web/plugins/api/schemas/unauthorized.ex b/lib/plausible_web/plugins/api/schemas/unauthorized.ex
index ceaf6f7245..c1d84e4eac 100644
--- a/lib/plausible_web/plugins/api/schemas/unauthorized.ex
+++ b/lib/plausible_web/plugins/api/schemas/unauthorized.ex
@@ -13,7 +13,7 @@ defmodule PlausibleWeb.Plugins.API.Schemas.Unauthorized do
title: "UnauthorizedError",
required: [:errors],
properties: %{
- errors: %OpenApiSpex.Schema{
+ errors: %Schema{
items: Schemas.Error,
type: :array
}
diff --git a/lib/plausible_web/plugins/api/schemas/unprocessable_entity.ex b/lib/plausible_web/plugins/api/schemas/unprocessable_entity.ex
index 76c3db73fe..e8109e005f 100644
--- a/lib/plausible_web/plugins/api/schemas/unprocessable_entity.ex
+++ b/lib/plausible_web/plugins/api/schemas/unprocessable_entity.ex
@@ -14,7 +14,7 @@ defmodule PlausibleWeb.Plugins.API.Schemas.UnprocessableEntity do
title: "UnprocessableEntityError",
required: [:errors],
properties: %{
- errors: %OpenApiSpex.Schema{
+ errors: %Schema{
items: Schemas.Error,
type: :array
}