You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
analytics/lib/plausible_web/plugins/api/schemas/goal/create_request.ex

39 lines
1.0 KiB
Elixir

defmodule PlausibleWeb.Plugins.API.Schemas.Goal.CreateRequest do
@moduledoc """
OpenAPI schema for Goal creation request
"""
use Plausible.Funnel
use PlausibleWeb, :open_api_schema
OpenApiSpex.schema(%{
title: "Goal.CreateRequest",
description: "Goal creation params",
type: :object,
oneOf: [
%Schema{
title: "Goal.CreateRequest.BulkGetOrCreate",
type: :object,
description: "Bulk goal creation request",
required: [:goals],
properties: %{
goals: %Schema{
type: :array,
minItems: 1,
maxItems: Funnel.max_steps(),
items: %Schema{
oneOf: [
Schemas.Goal.CreateRequest.CustomEvent,
Schemas.Goal.CreateRequest.Revenue,
Schemas.Goal.CreateRequest.Pageview
]
}
}
}
},
Schemas.Goal.CreateRequest.CustomEvent,
Schemas.Goal.CreateRequest.Revenue,
Schemas.Goal.CreateRequest.Pageview
]
})
end